Part Number Hot Search : 
001547 ACM4002F 220M25 TW0259A SFD377C ADM8695 MNR4G 225125P
Product Description
Full Text Search
 

To Download TMP86PS64FG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 8 Bit Microcontroller
TLCS-870/C Series
TMP86PS64FG
TMP86PS64FG
The information contained herein is subject to change without notice. 021023 _ D TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the "Handling Guide for Semiconductor Devices," or "TOSHIBA Semiconductor Reliability Handbook" etc. 021023_A The Toshiba products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). These Toshiba products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ("Unintended Usage"). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. Unintended Usage of Toshiba products listed in this document shall be made at the customer's own risk. 021023_B The products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. 060106_Q The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of TOSHIBA or others. 021023_C The products described in this document may include products subject to the foreign exchange and foreign trade laws. 021023_F For a discussion of how the reliability of microcontrollers can be predicted, please refer to Section 1.3 of the chapter entitled Quality and Reliability Assurance/Handling Precautions. 030619_S
(c) 2007 TOSHIBA CORPORATION All Rights Reserved
Page 2
Revision History
Date 2007/4/6 Revision 1 First Release
Table of Contents
TMP86PS64FG
1.1 1.2 1.3 1.4 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pin Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pin Names and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 4 6
2. Operational Descriptions
2.1 CPU Core Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Memory Address Map............................................................................................................................. 11 Program Memory (OTP) ......................................................................................................................... 12 Data Memory (RAM) ............................................................................................................................... 12 Clock Generator...................................................................................................................................... 13 Timing Generator .................................................................................................................................... 14 Operating Modes .................................................................................................................................... 16
Single-Clock Mode Dual-Clock Mode STOP Mode Operation Mode Transition Timing Generator Configuration Machine Cycle
2.2
2.1.1 2.1.2 2.1.3 2.2.1 2.2.2 2.2.3
System Clock Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.2.2.1 2.2.2.2 2.2.3.1 2.2.3.2 2.2.3.3 2.2.3.4 2.2.4.1 2.2.4.2 2.2.4.3 2.2.4.4
2.2.4
Operating Mode Control ......................................................................................................................... 21
STOP Mode IDLE1/2 and SLEEP1/2 Modes IDLE0 and SLEEP0 Modes SLOW Mode
2.3
Reset Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
External Reset Input ............................................................................................................................... Address-Trap-Reset ............................................................................................................................... Watchdog Timer Reset ........................................................................................................................... System Clock Reset ............................................................................................................................... 36 37 37 37
2.3.1 2.3.2 2.3.3 2.3.4
3. Interrupt Control Circuit
3.1 3.2 3.3 3.4 Interrupt latches (IL15 to IL2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Interrupt enable register (EIR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Interrupt Source Selector (INTSEL). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Interrupt Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Interrupt acceptance processing is packaged as follows........................................................................ 43 Saving/restoring general-purpose registers ............................................................................................ 44 Interrupt return ........................................................................................................................................ 46
Using PUSH and POP instructions Using data transfer instructions
3.2.1 3.2.2
Interrupt master enable flag (IMF) .......................................................................................................... 40 Individual interrupt enable flags (EF15 to EF4) ...................................................................................... 41
3.4.1 3.4.2 3.4.3 3.5.1
3.4.2.1 3.4.2.2
3.5
Software Interrupt (INTSW) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Address error detection .......................................................................................................................... 47
i
3.6 3.7 3.8
3.5.2
Undefined Instruction Interrupt (INTUNDEF). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Address Trap Interrupt (INTATRAP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Debugging .............................................................................................................................................. 47
4. Special Function Register (SFR)
4.1 4.2 SFR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 DBR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5. I/O Ports
5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 Port P0 (P07 to P00) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P1 (P17 to P10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P2 (P22 to P20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P3 (P37 to P30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P4 (P47 to P40) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P5 (P57 to P50) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P6 (P67to P60) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P7 (P77 to P70) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P8 (P87 to P80) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port P9 (P97 to P90) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port PA (PA7 to PA0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Port PB (PB7 to PB0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 57 58 59 60 62 63 65 67 68 69 70
6. Watchdog Timer (WDT)
6.1 6.2 Watchdog Timer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Watchdog Timer Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Malfunction Detection Methods Using the Watchdog Timer ................................................................... Watchdog Timer Enable ......................................................................................................................... Watchdog Timer Disable ........................................................................................................................ Watchdog Timer Interrupt (INTWDT)...................................................................................................... Watchdog Timer Reset ........................................................................................................................... Selection of Address Trap in Internal RAM (ATAS) ................................................................................ Selection of Operation at Address Trap (ATOUT) .................................................................................. Address Trap Interrupt (INTATRAP)....................................................................................................... Address Trap Reset ................................................................................................................................ 72 73 74 74 75
6.3
6.2.1 6.2.2 6.2.3 6.2.4 6.2.5
Address Trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
76 76 76 77
6.3.1 6.3.2 6.3.3 6.3.4
7. Time Base Timer (TBT)
7.1 Time Base Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Configuration .......................................................................................................................................... 79 Control .................................................................................................................................................... 79 Function .................................................................................................................................................. 80 Configuration .......................................................................................................................................... 81 Control .................................................................................................................................................... 81 7.1.1 7.1.2 7.1.3 7.2.1 7.2.2
7.2
Divider Output (DVO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
ii
8. 16-Bit TimerCounter 1 (TC1)
8.1 8.2 8.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 TimerCounter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Timer mode............................................................................................................................................. External Trigger Timer Mode .................................................................................................................. Event Counter Mode ............................................................................................................................... Window Mode ......................................................................................................................................... Pulse Width Measurement Mode............................................................................................................ Programmable Pulse Generate (PPG) Output Mode ............................................................................. 86 88 90 91 92 95
8.3.1 8.3.2 8.3.3 8.3.4 8.3.5 8.3.6
9. 16-Bit Timer/Counter2 (TC2)
9.1 9.2 9.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Timer mode........................................................................................................................................... 101 Event counter mode.............................................................................................................................. 103 Window mode ....................................................................................................................................... 103
9.3.1 9.3.2 9.3.3
10. 8-Bit TimerCounter 3 (TC3)
10.1 10.2 10.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 TimerCounter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
10.3.1 Timer mode......................................................................................................................................... 107 Figure 10-3 .................................................................................................................................................... 109 10.3.3 Capture Mode ..................................................................................................................................... 110
11. 8-Bit TimerCounter 4 (TC4)
11.1 11.2 11.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 TimerCounter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Timer Mode......................................................................................................................................... Event Counter Mode ........................................................................................................................... Programmable Divider Output (PDO) Mode ....................................................................................... Pulse Width Modulation (PWM) Output Mode .................................................................................... 114 115 116 117
11.3.1 11.3.2 11.3.3 11.3.4
12. 8-Bit TimerCounter 5 (TC5)
12.1 12.2 12.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 TimerCounter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Timer Mode......................................................................................................................................... Event Counter Mode ........................................................................................................................... Programmable Divider Output (PDO) Mode ....................................................................................... Pulse Width Modulation (PWM) Output Mode .................................................................................... 122 123 124 125
12.3.1 12.3.2 12.3.3 12.3.4
iii
13. 8-Bit TimerCounter 6 (TC6)
13.1 13.2 13.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 TimerCounter Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Timer Mode......................................................................................................................................... Event Counter Mode ........................................................................................................................... Programmable Divider Output (PDO) Mode ....................................................................................... Pulse Width Modulation (PWM) Output Mode .................................................................................... 130 131 132 133
13.3.1 13.3.2 13.3.3 13.3.4
14. Asynchronous Serial interface (UART )
14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 14.10 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transfer Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Infrared (IrDA) Data Format Transfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . Transfer Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Sampling Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . STOP Bit Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transmit/Receive Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Transmit Operation .................................................................................................................... 141 Data Receive Operation ..................................................................................................................... 141 Parity Error........................................................................................................................................ Framing Error.................................................................................................................................... Overrun Error .................................................................................................................................... Receive Data Buffer Full................................................................................................................... Transmit Data Buffer Empty ............................................................................................................. Transmit End Flag ............................................................................................................................ 142 142 142 143 143 144
135 136 138 139 140 140 141 141 141
14.9.1 14.9.2
Status Flag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
14.10.1 14.10.2 14.10.3 14.10.4 14.10.5 14.10.6
15. Synchronous Serial Interface (SIO1)
15.1 15.2 15.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Serial clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Clock source ....................................................................................................................................... 147 Shift edge............................................................................................................................................ 149
Leading edge Trailing edge Internal clock External clock 15.3.1.1 15.3.1.2 15.3.2.1 15.3.2.2
15.3.1 15.3.2
15.4 15.5 15.6
Number of bits to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Number of words to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Transfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
4-bit and 8-bit transfer modes ............................................................................................................. 150 4-bit and 8-bit receive modes ............................................................................................................. 152 8-bit transfer / receive mode ............................................................................................................... 153
15.6.1 15.6.2 15.6.3
16. Synchronous Serial Interface (SIO2)
16.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
iv
16.2 16.3
Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Serial clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Clock source ....................................................................................................................................... 159 Shift edge............................................................................................................................................ 161
Leading edge Trailing edge Internal clock External clock 16.3.1.1 16.3.1.2 16.3.2.1 16.3.2.2
16.3.1 16.3.2
16.4 16.5 16.6
Number of bits to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Number of words to transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Transfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
4-bit and 8-bit transfer modes ............................................................................................................. 162 4-bit and 8-bit receive modes ............................................................................................................. 164 8-bit transfer / receive mode ............................................................................................................... 165
16.6.1 16.6.2 16.6.3
17. 10-bit AD Converter (ADC)
17.1 17.2 17.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Register configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Software Start Mode ........................................................................................................................... 173 Repeat Mode ...................................................................................................................................... 173 Register Setting ................................................................................................................................ 174
17.4 17.5 17.6
17.3.1 17.3.2 17.3.3
STOP/SLOW Modes during AD Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Analog Input Voltage and AD Conversion Result . . . . . . . . . . . . . . . . . . . . . . . 176 Precautions about AD Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Analog input pin voltage range ........................................................................................................... 177 Analog input shared pins .................................................................................................................... 177 Noise Countermeasure ....................................................................................................................... 177
17.6.1 17.6.2 17.6.3
18. Key-on Wakeup (KWU)
18.1 18.2 18.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
19. OTP operation
19.1 Operating mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
MCU mode.......................................................................................................................................... 181
Program Memory Data Memory Input/Output Circuiry 19.1.1.1 19.1.1.2 19.1.1.3 19.1.2.1 19.1.2.2
19.1.1
19.1.2
PROM mode ....................................................................................................................................... 183
Programming Flowchart (High-speed program writing) Program Writing using a General-purpose PROM Programmer
20. Input/Output Circuitry
20.1 20.2 Control Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Input/Output Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
v
21. Electrical Characteristics
21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 Absolute Maximum Ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operating Condition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DC Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AD Conversion Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AC Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DC Characteristics, AC Characteristics (PROM mode). . . . . . . . . . . . . . . . . . .
Read operation in PROM mode.......................................................................................................... 194 Program operation (High-speed) ........................................................................................................ 195
189 190 191 192 193 194
21.6.1 21.6.2
Recommended Oscillating Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Handling Precaution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
22. Package Dimensions
This is a technical document that describes the operating functions and electrical specifications of the 8-bit microcontroller series TLCS-870/C (LSI).
vi
TMP86PS64FG
CMOS 8-Bit Microcontroller
TMP86PS64FG
The TMP86PS64FG is a single-chip 8-bit high-speed and high-functionality microcomputer incorporating 61440 bytes of One-Time PROM. It is pin-compatible with the TMP86CS64AFG (Mask ROM version). The TMP86PS64FG can realize operations equivalent to those of the TMP86CS64AFG by programming the on-chip PROM.
Product No. TMP86PS64FG ROM (EPROM) 61440 bytes RAM 2048 bytes Package QFP100-P-1420-0.65A MaskROM MCU TMP86CS64AFG Emulation Chip TMP86C964XB
1.1 Features
1. 8-bit single chip microcomputer TLCS-870/C series - Instruction execution time : 0.25 s (at 16 MHz) 122 s (at 32.768 kHz) - 132 types & 731 basic instructions 2. 21interrupt sources (External : 6 Internal : 15) 3. Input / Output ports (91 pins) Large current output: 16pins (Typ. 20mA), LED direct drive 4. Watchdog Timer 5. Prescaler - Time base timer - Divider output function 6. 16-bit timer counter: 1 ch - Timer, External trigger, Window, Pulse width measurement, Event counter, Programmable pulse generate (PPG) modes 7. 16-bit timer counter: 1 ch - Timer, Event counter, Window modes
060116EBP
* The information contained herein is subject to change without notice. 021023_D * TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the "Handling Guide for Semiconductor Devices," or "TOSHIBA Semiconductor Reliability Handbook" etc. 021023_A * The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunctionor failure of which may cause loss of human life or bodily injury ("Unintended Usage"). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's own risk. 021023_B * The products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. 060106_Q * The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of TOSHIBA or others. 021023_C * The products described in this document are subject to the foreign exchange and foreign trade laws. 021023_E * For a discussion of how the reliability of microcontrollers can be predicted, please refer to Section 1.3 of the chapter entitled Quality and Reliability Assurance/Handling Precautions. 030619_S
Page 1
1.1 Features
TMP86PS64FG
8. 8-bit timer counter : 1 ch - Timer, Event counter, Capture modes 9. 8-bit timer counter : 3 ch - Timer, Event counter, Pulse width modulation (PWM) output, Programmable divider output (PDO) modes 10. 8-bit UART : 1 ch 11. 8-bit SIO: 2 ch 12. 10-bit successive approximation type AD converter - Analog input: 16 ch 13. Key-on wakeup : 4 ch 14. Clock operation Single clock mode Dual clock mode 15. Low power consumption operation STOP mode: Oscillation stops. (Battery/Capacitor back-up.) SLOW1 mode: Low power consumption operation using low-frequency clock.(High-frequency clock stop.) SLOW2 mode: Low power consumption operation using low-frequency clock.(High-frequency clock oscillate.) IDLE0 mode: CPU stops, and only the Time-Based-Timer(TBT) on peripherals operate using high frequency clock. Release by falling edge of the source clock which is set by TBTCR. IDLE1 mode: CPU stops and peripherals operate using high frequency clock. Release by interruputs(CPU restarts). IDLE2 mode: CPU stops and peripherals operate using high and low frequency clock. Release by interruputs. (CPU restarts). SLEEP0 mode: CPU stops, and only the Time-Based-Timer(TBT) on peripherals operate using low frequency clock.Release by falling edge of the source clock which is set by TBTCR. SLEEP1 mode: CPU stops, and peripherals operate using low frequency clock. Release by interruput.(CPU restarts). SLEEP2 mode: CPU stops and peripherals operate using high and low frequency clock. interruput. 16. Wide operation voltage:
4.5 V to 5.5 V at 16MHz /32.768 kHz 2.7 V to 5.5 V at 8 MHz /32.768 kHz
Release by
Page 2
1.2 Pin Assignment
P84 P85 P86 P87 P90 P91 P92 P93 P94 P95 P96 P97 P50 P51 P52 P53 P54 P55 P56 P57
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
VSS XIN XOUT TEST VDD (XTIN) P21 (XTOUT) P22
RESET
Figure 1-1 Pin Assignment
Page 3
(STOP/INT5) P20 (PWM4/PDO4/TC4) P30 (PWM5/PDO5/TC5) P31 (PWM6/PDO6/TC6) P32 (SCK1) P33 (SI1) P34 (SO1) P35 (SI2) P36 (SO2) P37 (SCK2) P40 (RXD1) P41 (TXD1) P42 P43 (RXD2) P44 (TXD2) P45 (TC3/INT3) P46 (INT4) P47 (AIN0) P60 (AIN1) P61 (AIN2) P62 (AIN3) P63 (AIN4) P64
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51
P83 P82 P81 P80 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0 P07 P06 P05 P04 P03 P02 P01 P00 P17 P16
50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31
P15 (TC2) P14 (PPG) P13 (DVO) P12 (INT2/TC1) P11 (INT1) P10 (INT0) AVSS AVDD VAREF P77 (AIN15/STOP5) P76 (AIN14/STOP4) P75 (AIN13/STOP3) P74 (AIN12/STOP2) P73 (AIN11) P72 (AIN10) P71 (AIN9) P70 (AIN8) P67 (AIN7) P66 (AIN6) P65 (AIN5)
TMP86PS64FG
1.3 Block Diagram
TMP86PS64FG
1.3 Block Diagram
Page 4
TMP86PS64FG
Figure 1-2 Block Diagram
Page 5
1.4 Pin Names and Functions
TMP86PS64FG
1.4 Pin Names and Functions
The TMP86PS64FG has MCU mode and PROM mode. Table 1-1 shows the pin functions in MCU mode. The PROM mode is explained later in a separate chapter.
Table 1-1 Pin Names and Functions(1/4)
Pin Name P07 P06 P05 P04 P03 P02 P01 P00 P17 P16 P15 TC2 P14
PPG
Pin Number 60 59 58 57 56 55 54 53 52 51 50
Input/Output IO IO IO IO IO IO IO IO IO IO IO I IO O IO O IO I I IO I IO I IO O IO I IO I I IO O IO I IO O IO I PORT07 PORT06 PORT05 PORT04 PORT03 PORT02 PORT01 PORT00 PORT17 PORT16 PORT15 TC2 input PORT14 PPG output PORT13 Divider Output PORT12 External interrupt 2 input TC1 input PORT11 External interrupt 1 input PORT10 External interrupt 0 input
Functions
49
P13
DVO
48
P12 INT2 TC1 P11 INT1 P10
INT0
47
46
45
P22 XTOUT P21 XTIN P20
INT5 STOP
7
PORT22 Low frequency OSC output pin PORT21 Low frequency OSC input pin PORT20 External interrupt 5 input STOP mode release input PORT37 Serial Data Output 2 PORT36 Serial Data Input 2 PORT35 Serial Data Output 1 PORT34 Serial Data Input 1
6
9
P37 SO2 P36 SI2 P35 SO1 P34 SI1
17
16
15
14
Page 6
TMP86PS64FG
Table 1-1 Pin Names and Functions(2/4)
Pin Name P33
SCK1
Pin Number 13
Input/Output IO IO IO I O IO I O IO I O IO I IO I I IO O IO I I IO IO O IO I IO IO IO IO IO IO IO IO IO IO IO I IO I IO I IO I IO I PORT33 Serial Clock I/O 1 PORT32 TC6 input PWM6/PDO6 output PORT31 TC5 input PWM5/PDO5 output PORT30 TC4 input PWM4/PDO4 output PORT47 External interrupt 4 input PORT46 External interrupt 3 input TC3 pin input PORT45 UART data output 2
Functions
P32 TC6
PWM6/PDO6
12
P31 TC5
PWM5/PDO5
11
P30 TC4
PWM4/PDO4
10
P47 INT4 P46 INT3 TC3 P45 TXD2 P44 RXD2 BOOT P43 P42 TXD1 P41 RXD1 P40
SCK2
25
24
23
22
PORT44 UART data input 2 Serial PROM mode control input PORT43 PORT42 UART data output 1 PORT41 UART data input 1 PORT40 Serial Clock I/O 2 PORT57 PORT56 PORT55 PORT54 PORT53 PORT52 PORT51 PORT50 PORT67 Analog Input7 PORT66 Analog Input6 PORT65 Analog Input5 PORT64 Analog Input4 PORT63 Analog Input3
21 20
19
18 100 99 98 97 96 95 94 93 33
P57 P56 P55 P54 P53 P52 P51 P50 P67 AIN7 P66 AIN6 P65 AIN5 P64 AIN4 P63 AIN3
32
31
30
29
Page 7
1.4 Pin Names and Functions
TMP86PS64FG
Table 1-1 Pin Names and Functions(3/4)
Pin Name P62 AIN2 P61 AIN1 P60 AIN0 P77 AIN15 STOP5 P76 AIN14 STOP4 P75 AIN13 STOP3 P74 AIN12 STOP2 P73 AIN11 P72 AIN10 P71 AIN9 P70 AIN8 P87 P86 P85 P84 P83 P82 P81 P80 P97 P96 P95 P94 P93 P92 P91 P90 PA7 Pin Number 28 Input/Output IO I IO I IO I IO I I IO I I IO I I IO I I IO I IO I IO I IO I IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO PORT62 Analog Input2 PORT61 Analog Input1 PORT60 Analog Input0 PORT77 Analog Input15 STOP5 input PORT76 Analog Input14 STOP4 input PORT75 Analog Input13 STOP3 input PORT74 Analog Input12 STOP2 input PORT73 Analog Input11 PORT72 Analog Input10 PORT71 Analog Input9 PORT70 Analog Input8 PORT87 PORT86 PORT85 PORT84 PORT83 PORT82 PORT81 PORT80 PORT97 PORT96 PORT95 PORT94 PORT93 PORT92 PORT91 PORT90 PORTA7 Functions
27
26
41
40
39
38
37
36
35
34 84 83 82 81 80 79 78 77 92 91 90 89 88 87 86 85 68
Page 8
TMP86PS64FG
Table 1-1 Pin Names and Functions(4/4)
Pin Name PA6 PA5 PA4 PA3 PA2 PA1 PA0 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 XIN XOUT
RESET
Pin Number 67 66 65 64 63 62 61 76 75 74 73 72 71 70 69 2 3 8 4 42 43 44 5 1
Input/Output IO IO IO IO IO IO IO IO IO IO IO IO IO IO IO I I I I I I I I I PORTA6 PORTA5 PORTA4 PORTA3 PORTA2 PORTA1 PORTA0 PORTB7 PORTB6 PORTB5 PORTB4 PORTB3 PORTB2 PORTB1 PORTB0
Functions
High frequency OSC input pin High frequency OSC output pin RESET input TEST pin (Fix to Low level) Analog Base Voltage Input Pin for A/D Conversion Analog Power Supply Analog Power Supply VDD pin Power Supply
TEST VAREF AVDD AVSS VDD VSS
Page 9
1.4 Pin Names and Functions
TMP86PS64FG
Page 10
TMP86PS64FG
2. Operational Descriptions
2.1 CPU Core Function
The CPU core consists of a CPU, a system clock controller and an interrupt controller. This chapter provides descriptions of the CPU core, the program memory, the data memory and the reset circuit.
2.1.1
Memory Address Map
TMP86PS64FG memory consists of RAM and Special Function Register (SFR), which are mapped to a 64 Kbyte address space. The TMP86PS64FG memory consists of OTP, RAM, Special Function Register (SFR) and Data Buffer Resister (DBR), which are mapped to a 64 kbyte address space. Figure 2-1 shows the TMP86PS64FG memory address map.
SFR
0000H 003FH 0040H
64 bytes
SFR:
RAM
2048 bytes RAM: 083FH
Special function register I/O port Peripheral hardware control register Peripheral hardware status register System control register Program status word Random access memory Data memory Stack
0F80H DBR 128 bytes 0FFFH DBR:
Data buffer register Peripheral hardware control register Peripheral hardware status register
1000H
OTP: Program memory
OTP
FFC0H FFDFH FFE0H FFFFH
61440 bytes Vector table for vector call instructions (32 bytes) Instruction vector table (32 bytes)
Figure 2-1 Memory Address Map
Page 11
2. Operational Descriptions
2.1 CPU Core Function TMP86PS64FG
2.1.2
Program Memory (OTP)
TMP86PS64FG incorporates the 61440-byte (addresses from 1000H through FFFFH) program memory (OTP).
2.1.3
Data Memory (RAM)
TMP86PS64FG incorporates the 2048-byte (addresses from 0040H through 083FH) RAM. Since the address space from 0040H through 00FFH within the on-chip RAM can be accessed directly, it can be accessed by instructions to shorten the processing time. Perform initial setting through an initialize routine since the contents of the data memory become don't cares at power-up.
Example :Clearing RAM of TMP86PS64FG
LD LD LD SRAMCLR: LD INC DEC JRS HL, 0040H A, H BC,07FFH (HL), A HL BC F, SRAMCLR : Sets the start address : Sets the initialization data (00H) : Sets the number of bytes (-1)
Page 12
TMP86PS64FG
2.2 System Clock Controller
The system clock controller consists of a clock generator, a timing generator and a operating mode controller.
Divider control Timing generator register control register CGCR TBTCR Clock generator XIN High-frequency clock oscillator XOUT XTIN Low-frequency clock oscillator XTOUT Oscillate/Stop control fs System clock fc Operating mode controller Timing generator 0038H SYSCR1 0039H SYSCR2 0030H 0036H
System control register
Figure 2-2 System Clock Controller 2.2.1 Clock Generator
The clock generator generates the basic clock which provides the system clocks to be supplied to the CPU core and peripheral hardware. The clock generator contains two oscillators used for the high- and low-frequency clocks. Power consumption can be reduced by the low-speed operation with the low-frequency clock, which is switched by the operating mode controller.
The high-frequency clock (fc) or low-frequency clock (fs) can be obtained easily by connecting a resonator between the XIN and XOUT pins, or XTIN and XTOUT pins, respectively. The clock can be supplied from an external oscillator. In this case, supply the clock via the XIN or XTIN pin, and leave the XOUT or XTOUT pins unconnected.
High-frequency clock XIN XOUT XIN XOUT XTIN
Low-frequency clock XTOUT XTIN XTOUT
(Unconnected)
(Unconnected)
(a) Crystal or ceramic resonator
(b) External oscillator
(c) Crystal resonator
(d) External oscillator
Figure 2-3 Example Resonator Connection
Note:The hardware feature does not provide the function to monitor externally the basic clock directly. However, with disabling all interrupts and watchdog timers, the oscillation frequency can be adjusted by programming to output a fixed-frequency pulse (i.e., clock output) to a port and monitoring the pulse. For the system to require the adjustment of the oscillation frequency, the adjustment program must be created beforehand.
Page 13
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
2.2.2
Timing Generator
The timing generator generates various types of system clocks which are supplied to the CPU core or peripheral hardware from the basic clock (fc or fs). The timing generator provides the following functions. 1. Generating the main system clock 2. Generating the divider output (DVO) pulses 3. Generating the source clocks for the time base timer 4. Generating the source clocks for the watchdog timer 5. Generating the internal source clocks for the TimerCounter 6. Generating the warm-up clocks upon exit from the STOP mode
2.2.2.1
Timing Generator Configuration
The timing generator consists of a 3-stage prescaler, a 21-stage divider, a main system clock generator and a machine cycle counter. Either the clock fc/4 output from the 2nd stage or the clock fc/8 output from the 3rd stage can be selected as the clock input to the 1st stage of the divider by CGCR. This function enables to operate the peripheral circuits without program change by inputting fc/8 to the 1st stage of the divider when the operation clock is multiplied by 2. (ex., 8 MHz to 16 MHz) The input clock to the 7th stage of the divider depends on SYSCR2, TBTCR and CGCR settings, as shown in Table 2-2. The prescaler and divider are cleared to 0 upon reset and entry to/exit from the STOP mode.
Note: TBTCR indicates the bit 4 (DV7CK) of the timing generator (TBTCR). Hereafter, this notational convention is used for each functional bit of the register.
Table 2-1 Divider Output
Divider Output DV1CK = 0 DV1G fc/23 DV2G fc/24 DV3G fc/25 DV4 fc/26 DV5 fc/27 DV1G fc/24 DV2G fc/25 DV1CK = 1 DV3G fc/26 DV4 fc/27 DV5 fc/28
Table 2-2 Input Clock to 7th Stage of the Divider [Hz]
NORMAL1, IDLE1 mode DV7CK = 0 DV1CK = 0 fc/28 DV1CK = 1 fc/29 NORMAL2, IDLE2 mode (SYSCK=0) DV7CK = 0 DV7CK = 1 DV1CK = 0 fc/28 DV1CK = 1 fc/29 fs SLOW1/2, SLEEP1/2 mode (SYSCK = 1) fs
Note 1: Do not set TBTCR to 1 during the NORMAL1 or IDLE1 mode. Note 2: Since the input clock to the 1st stage of the divider is stopped in the SLOW1/2 or SLEEP1/2 mode, output from the 1st to 7th stages of the divider is also stopped.
Page 14
TMP86PS64FG
Main system clock generator
SYSCR2 TBTCR CGCR Prescaler
fc or fs
Machine cycle counter
DV1
DV2
DV3
DV4
DV5
DV6
DV7
DV8
DV9
DV10
DV12
DV13
DV14
DV15
DV16
DV17
DV18
DV20
Low-frequency clock fc
Selector
Selector
DV21
DV11
High-frequency clock fc
012
S A Y B
Divider
123456
S A Y B
Divider
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
S Selector B0 B1 A0 Y0 Warm-up A1 Y1
controller
Watchdog timer
TimerCounter, time base timer, divider output, etc.
Figure 2-4 Timing Generator Configuration
Table 2-3 Division Ratio of the Divider
DV7CK = 0 DV1CK = 0 DV1 DV2 DV3 DV4 DV5 DV6 DV7 DV8 DV9 DV10 DV11 fc/23 fc/24 fc/25 fc/26 fc/27 fc/28 fc/29 fc/210 fc/211 fc/212 fc/213 DV1CK = 1 fc/24 fc/25 fc/26 fc/27 fc/28 fc/29 fc/210 fc/211 fc/212 fc/213 fc/214 DV7CK = 1 DV1CK = 0 fc/23 fc/24 fc/25 fc/26 fc/27 fc/28 fs/2 fs/22 fs/23 fs/24 fs/25 DV1CK = 1 fc/24 fc/25 fc/26 fc/27 fc/28 fc/29 DV12 DV13 DV14 DV15 DV16 DV17 DV18 DV19 DV20 DV21 DV7CK = 0 DV1CK = 0 fc/214 fc/215 fc/216 fc/217 fc/218 fc/219 fc/220 fc/221 fc/222 fc/223 DV1CK = 1 fc/215 fc/216 fc/217 fc/218 fc/219 fc/220 fc/221 fc/222 fc/223 fc/224 DV7CK = 1 DV1CK = 0 DV1CK = 1
fs/26 fs/27 fs/28 fs/29 fs/210 fs/211 fs/212 fs/213 fs/214 fs/215
Divider Control Register
CGCR (0030H) 7 "0" 6 "0" 5 DV1CK 4 "0" 3 "0" 2 "0" 1 "0" 0 "0" (Initial value: **0* ****)
DV1CK
Selection of the input clock to the 1st stage of the divider [Hz]
0: 1:
fc/4 fc/8
R/W
Note 1: fc: High-frequency clock [Hz], *: Don't care Note 2: The bit 4 and 3 are read as a don't care when the read instruction is executed to CGCR.
Page 15
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
Note 3: 0 must be written to the bit 7, 6, 4 through 0 of CGCR.
Timing Generator Control Resister
7 TBTCR (0036H) (DVOE N) 6 5 4 DV7CK 3 (TBTE N) 2 1 (TBTCK) 0 (Initial value: 0000 0000)
(DVOCK)
DV7CK
Selection of the input clock to the 7th stage of the divider
0: fc/28[Hz] 1: fs
R/W
Note 1: Do not set DV7CK to 1 in the single-clock mode. Note 2: Do not set DV7CK to 1 until the low-frequency clock oscillation is stabilized. Note 3: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 4: In the SLOW 1/2 or SLEEP1/2 mode, fs is input to the 7th stage of the divider regardless of DV7CK setting. Note 5: When the STOP mode is entered from the NORMAL1/2 mode, the output of the 6th stage of the divider is input to the 7th stage of the divider during warm up after exiting from the STOP mode regardless of DV7CK setting.
2.2.2.2
Machine Cycle
The instruction execution and peripheral hardware operation are synchronized with the system clock. The minimum instruction execution unit is called a "machine cycle". There are 10 types of instructions for TLCS-870/C Series, which are 1-cycle instructions to be executed within 1-cycle through 10-cycle instructions to be executed within ten cycles. A machine cycle consists of 4 states (S0 to S3), and each state consists of one main system clock.
1/fc or 1/fs [s]
Main system clock State S0 S1 S2 S3 S0 S1 S2 S3
Machine cycle
Figure 2-5 Machine Cycle 2.2.3 Operating Modes
The operating mode controller starts and stops the oscillators for the high-frequency and low-frequency clocks, and switches the main system clock. The device has the single-clock, dual-clock and STOP modes, which can be controlled by the system control registers (SYSCR1 and SYSCR2). Figure 2-6 shows the operating mode transition.
Page 16
TMP86PS64FG
2.2.3.1
Single-Clock Mode
In the single-clock mode, only the oscillator for high-frequency clock is used. The P21(XTIN) and P22 (XTOUT) pins for the low-frequency clock can be used as usual I/O ports. Since the main system clock is generated from the high-frequency clock, the machine cycle time becomes 4/fc [s] in the single-clock mode. (1) NORMAL1 mode In the NORMAL1 mode, the CPU core and on-chip peripherals operate using the high-frequency clock. After reset is released, NOMAL1 mode is entered. (2) IDLE1 mode In the IDLE1 mode, the CPU and watchdog timer are halted, and on-chip peripherals are clocked by the high-frequency clock. To enter the IDLE1 mode, set IDEL in the system control register 2 (SYSCR2) to 1. The IDLE1 mode is exited by the interrupt from the on-chip peripherals or external interrupts, and returned to the NORMAL1 mode. When the IMF (interrupt master enable flag) is set to 1 (interrupt enable), the normal operation is performed after the interrupt processing is completed. When the IMF is set to 0 (interrupt disable), program execution resumes with the instruction immediately following the instruction that activated the IDLE1 mode. (3) IDLE0 mode In the IDLE0 mode, the CPU and on-chip peripherals are halted except oscillator and TBT. The IDEL0 mode is entered by setting the system control register SYSCR2 to 1 in the NORMAL1 mode. When the IDLE0 mode is entered, the CPU is halted and the timing generator stops clocking to the peripherals except TBT. When detecting the falling edge of the source clock set in TBTCR, the timing generator starts clocking to all on-chip peripherals. When the IDLE0 mode is exited, the CPU restarts operation and returns to the NORMAL1 mode. The IDLE0 mode is entered and returned to the NORMAL1 mode regardless of setting in TBTCR. Interrupt processing is performed when IMF = 1, EF8 (TBT interrupt enable flag) = 1, and TBTCR = 1. When the IDLE0 mode is entered with TBTCR = 1, INTTBT interrupt latch is set after returning to the NORMAL mode.
2.2.3.2
Dual-Clock Mode
In the dual-clock mode, two oscillators for high-frequency and low-frequency are used. The P21 (XTIN) and P22 (XTOUT) pins are used for the low-frequency clock pins. (In the dual-clock mode, these pins can not be used as I/O ports.) The main system clock is generated by the high-frequency clock in the NORMAL2 and IDLE2 modes, and the low-frequency clock in the SLOW1/2 and SLEEP1/2 modes. Therefore, the machine cycle time is 4/fc [s] in the NORMAL2 and IDLE2 modes, and 4/fs [s] (122 s @ fs = 32.768 kHz) in the SLOW and SLEEP modes. The TLCS-870/C series is put in the single-clock mode during reset. To use the dual-clock mode, oscillate the low-frequency clock at the top of the program. (1) NORMAL2 Mode The CPU core operates with high-frequency clock. On-chip peripherals operate with high- and low-frequency clocks. Page 17
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
(2)
SLOW2 Mode The CPU core operates with low-frequency clock. Switching from NORMAL2 to SLOW2, and vise-versa is programmed in SYSCR2. Do not clear XTEN to 0 in the SLOW2 mode.
(3)
SLOW1 Mode Power dissipation can be reduced by stopping high-frequency clock oscillation, and operating the CPU core and on-chip peripherals with low-frequency clock. Switching from SLOW1 to SLOW2, and vise-versa is programmed in SYSCR2. In the SLOW1 and SLEEP1 modes, output from the 1st to 6th stages is stopped.
(4)
IDLE2 Mode The CPU and watchdog timer are halted, and on-chip peripherals are operated with the high- and low-frequency clocks. Entering and exiting the IDLE2 mode is the same as for the IDLE1 mode. After exiting the IDLE2 mode, the CPU returns to the NORMAL2 mode.
(5)
SLEEP1 Mode The CPU and watchdog timer are halted, and on-chip peripherals are operated with the low-frequency clock. Entering and exiting the SLEEP1 mode is the same as for the IDLE1 mode. After exiting the SLEEP1 mode, th CPU returns to the SLOW1 mode. High-frequency clock oscillation is stopped. In the SLOW1 and SLEEP1 modes, output from the 1st to 6th stages is stopped.
(6)
SLEEP2 Mode The SLEEP2 mode is the idle mode corresponding to the SLOW2 mode. The SLEEP2 mode is the same as the SLOW2 mode except that high-frequency clock is activated.
(7)
SLEEP0 Mode The CPU and on-chip peripherals are halted except oscillator and TBT. The SLEEP0 mode is entered by setting the system control register SYSCR2 to 1 in the SLOW1 mode. When the SLEEP0 mode is entered, the CPU is halted and the timing generator stops clocking to the peripherals except TBT. When detecting the falling edge of the source clock set in TBTCR, the timing generator starts the clocking operation to all on-chip peripherals. When the SLEEP0 mode is exited, the CPU restarts operation and returns to the SLOW1 mode. the CPU enters to the SLEEP0 mode and returns to the SLOW1 mode regardless of setting in TBTCR. Interrupt processing is performed when IMF = 1, EF8 (TBT interrupt enable flag) = 1, and TBTCR = 1. When the SLEEP0 mode is entered with TBTCR = 1, INTTBT interrupt latch is set after returning to the SLOW1 mode.
Page 18
TMP86PS64FG
2.2.3.3
STOP Mode
In the STOP mode, all system operations including oscillators are halted, and the internal conditions immediately before the halt are retained with low-power dissipation. The STOP mode is entered by setting the system control register 1, and exited with the STOP pin input. After the warm-up period time has expired, the CPU returns to the mode it was before entering the STOP mode, and program execution resumes with the instruction immediately following the instruction that activated the STOP mode.
2.2.3.4
Operation Mode Transition
IDLE0 mode SYSCR2 = "1"(Note 2) SYSCR2 = "1" IDLE1 mode Interrupt (a) Single-clock mode SYSCR2 = "0" SYSCR2 = "1" NORMAL2 mode Interrupt SYSCR2 = "0" SYSCR2 = "1" SLEEP2 mode Interrupt SYSCR2 = "0" SYSCR2 = "1" SYSCR2 = "1" SLEEP1 mode Interrupt (b) Dual-clock mode SLEEP0 mode SLOW1 mode SLOW2 mode NORMAL1 mode
RESET Reset released SYSCR1 = "1"
STOP pin input SYSCR2 = "1" SYSCR1 = "1"
IDLE2 mode
STOP pin input SYSCR2 = "1"
STOP
SYSCR1 = "1"
STOP pin input (Note 2) SYSCR2 = "1"
Note 1: NORMAL1 and NORMAL2 modes are generically called NORMAL mode: SLOW1 and SLOW2 are called SLOW mode: IDLE0 and IDLE1 and IDLE2 are called IDLE mode: SLEEP0, SLEEP1 and SLEEP2 are called SLEEP mode. Note 2: This mode is exited at the falling edge of the source clock selected in TBTCR.
Figure 2-6 Operating Mode Transition
Page 19
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
Table 2-4 Operating Mode and Conditions
Oscillator Operating Mode High-freq. RESET NORMAL1 SingleClock Oscillation IDLE1 IDLE0 STOP NORMAL2 IDLE2 Oscillation SLOW2 Dual-Clock SLEEP2 SLOW1 SLEEP1 SLEEP0 STOP Stop Stop Halt Halt Halt Oscillation Operate with Low-freq. Halt Operate with Low-freq. Operate 4/fs [s] Operate Stop Operate with High-freq. Halt Stop Halt Halt Halt Operate Low-freq. Reset Operate Operate 4/fc [s] Reset CPU Core TBT Other Peripherals Reset Machine Cycle Time
4/fc [s]
Page 20
TMP86PS64FG
2.2.4
Operating Mode Control
System Control Register 1
7 SYSCR1 (0038H) STOP 6 RELM 5 RETM 4 OUTEN 3 WUT 2 1 "0" 0 (Initial value: 0000 00**)
STOP
STOP mode enter
0: CPU core and peripherals operate 1: CPU core and peripherals halt (Enter STOP mode) 0: Edge-sensitive (Exit at the rising edge of STOP pin) 1: Level-sensitive (Exit at the high level of STOP pin) 0: Return to NORMAL 1/2 mode 1: Return to SLOW1 mode 0: High impedance 1: Output retained Return to NORMAL 1/2 mode DV1CK=0 DV1CK=1 3 x 217/fc 217/fc 3 x 215/fc 2 /fc
15
R/W
RELM
STOP mode exit method Operating mode after STOP mode Port output during STOP mode
R/W
RETM
R/W
OUTEN
R/W Return to SLOW1 mode 3 x 213/fs 213/fs 3 x 26/fs 26/fs R/W
WUT
Warm-up time on exiting STOP mode [ns]
00 01 10 11
3 x 216/fc 216/fc 3 x 214/fc 2 /fc
14
Note 1: To transit from the NOMAL mode to the STOP mode, set RETM to 0. To transit from the STOP mode to the NOMAL mode, set RETM to 1. Note 2: When exiting the STOP mode with the RESET pin input, the CPU returns to the NORMAL1 mode regardless of the RETM value. Note 3: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 4: Bit 1 and 0 in SYSCR1 are read as don't cares. Note 5: When entering the STOP mode with OUTEN = 0, input value is fixed to 0. That may cause an external interrupt request to be set on falling edge. Note 6: To use the Key on wake-up is used, set RELM to 1. Note 7: The P20 pin is shared with the STOP pin. When the STOP mode is entered, output assumes the high-impedance state regardless of the OUTEN state. Note 8: Select the warm-up period time depending on the feature of the resonator to be used.
Page 21
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
System Control Register 2
7 SYSCR2 (0039H) XEN 6 XTEN 5 SYSCK 4 IDLE 3 2 TGHAL T 1 0 (Initial value: 1000 *0**)
XEN XTEN SYSCK IDLE
High-frequency oscillator control Low-frequency oscillator control System clock select (write)/monitor (read) CPU and WDT control (IDLE1/2, SLEEP1/2 mode) TG control (IDLE0, SLEEP0 mode)
0: Stop oscillation 1: Continue or start oscillation 0: Stop oscillation 1: Continue or start oscillation 0: High-frequency clock (NORMAL1/NORMAL2/IDLE1/IDLE2) 1: Low-frequency clock (SLOW/SLEEP) 0: CPU, WDT enabled 1: CPU, WDT disabled (Enter IDLE1/2, SLEEP1/2 mode) 0: Clocking operation to all peripherals from TG 1: Stop the clocking operation to peripherals except TBT from TG (Enter IDLE0, SLEEP0 mode) R/W R/W
TGHALT
R/W
Note 1: Reset is performed when both XEN and XTEN are cleared to 0, XEN is cleared to 0 with SYSCK = 0, or XTEN is cleared to 0 with SYSCK = 1. Note 2: WDT: watchdog timer, TG: timing generator, *: Don't care Note 3: When the bit 3, 1 or 0 of SYSCR2 is read, a don't care is read. Note 4: Do not set IDLE and TGHALT to 1 simultaneously. Note 5: Since the IDLE0/SLEEP0 mode is returned to the NORMAL1/SLOW1 mode by the asynchronous internal source clock specified in TBTCR, the time to return to the NORMAL1/SLOW1 mode from the IDLE0/SLEEP0 mode is shorter than the period time specified in TBTCR. Note 6: Upon exit from the IDLE1/2 or SLEEP1/2 mode, IDLE is automatically cleared to 0. Note 7: Upon exit from the IDLE0 or SLEEP0 mode, TGHALT is automatically cleared to 0. Note 8: When setting TGHAL to 1, stop functions of on-chip peripherals beforehand. If not stopped, an interrupt latch to the peripherals may be set immediately after the IDLE0 or SLEEP0 mode is exited.
Page 22
TMP86PS64FG
2.2.4.1
STOP Mode
The STOP mode is controlled by the system control resister 1 (SYSCR1), STOP pin input and STOP5 to STOP2. The STOP pin is used as the P20 port and INT5 pin (external interrupt input 5). The STOP mode is entered by setting SYSCR1 to 1, and the following status is held in the STOP mode. 1. Both high-frequency and low-frequency oscillations are stopped, and all internal behaviors are stopped. 2. The data memory, registers, and program status words and port output latches hold the status before the STOP mode is entered. 3. The prescaler and divider of the timing generator are cleared to 0. 4. The program counter holds the address of the instruction after next to the instruction (e.g., [SET(SYSCR1).7]) by which the STOP mode is entered. The STOP mode contains the level-sensitive and edge-sensitive exit modes which can be selected in SYSCR1. In the case of the edge-sensitive exit mode, STOP5 to STOP2 must be disabled.
Note 1: Unlike the key-on wake-up input pin, the STOP pin does not have the function to disable input. To use the STOP mode, the STOP pin must be used to exit the STOP mode. Note 2: During STOP period (from the start of the STOP mode to the end of warm-up period time), interrupt latches are set to 1 due to external interrupt signal changes, and interrupts may be accepted immediately after the STOP mode is exited. Therefore, disable interrupts before entering the STOP mode. Before enabling interrupts after the STOP mode is exited, clear unnecessary interrupt latches beforehand.
(1)
Level-sensitive exit mode (RELM = 1) In this mode, the STOP mode is exited by setting the STOP pin to high or STOP5 to STOP2 (can be specified to each bit in STOPCR) to low. This mode is used for capacitor back-up when the main power supply is cut off and long tern battery back-up. When the STOP pin input is set to high or STOP5 to STOP2 is set to low, executing an instruction to enter the STOP mode does not enter the STOP mode, but immediately starts the exit sequence (warm-up). When the STOP mode is entered in the level-sensitive exit mode, it is required to check that the STOP pin input is programmed to low and the STOP5 to STOP2 pin input is programmed to high by the following methods. 1. Testing the port condition. 2. Using the INT5 interrupt (an interrupt is generated at the falling edge of the INT5 pin input)
Example 1 :Entering the STOP mode from the NORMAL mode by testing a port P20
LD SSTOPH: TEST JRS DI SET (SYSCR1) . 7 (SYSCR1), 01010000B (P2PRD) . 0 F, SSTOPH : IMF0 : Enters the STOP mode. : Sets the level-sensitive exit mode. : Wait state until the STOP pin input becomes low.
Page 23
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
Example 2 :Entering the STOP mode from the NORMAL mode by the INT5 interrupt
PINT5: TEST JRS LD DI SET SINT5: RETI (SYSCR1) . 7 (P2PRD) . 0 F, SINT5 (SYSCR1), 01010000B : IMF0 : Enters the STOP mode. : To eliminate spurious noise, the STOP mode is not entered if the P20 port input is set to high. : Sets the level-sensitive exit mode.
STOP pin
VIH
XOUT pin NORMAL mode STOP mode Detect the low level of the STOP pin input by programming and enter the STOP mode. Warm-up NORMAL mode
Exit the STOP mode by hardware. Whenever the STOP pin input is set to high, the STOP mode is exited.
Figure 2-7 Level-Sensitive Exit Mode
Note 1: After a warm-up period starts, the STOP mode is not reentered if the STOP pin input becomes low or STOP5 to STOP2 becomes high again. Note 2: To return to the level-sensitive exit mode after setting up the edge-sensitive exit mode, the exit mode is not switched until the rising edge of the STOP pin input is detected.
(2)
Edge-sensitive exit mode (RELM = 0) In this mode, the STOP mode is exited at the rising edge of the STOP pin input. This mode is used in applications where a relatively short program is run repeatedly at periodic intervals. This periodic signal (i.e., a clock from a low-power consumption oscillator) is input input to the STOP pin. In the edge-sensitive exit mode, the STOP mode is entered even if the STOP pin input is high. Disable the STOP5 to STOP2 pin input with the key-on wake-up control register (STOPCR).
Example :Entering the STOP mode from the NORMAL mode
DI LD (SYSCR1) , 10010000B : IMF0 : Sets the edge-sensitive exit mode to enter the STOP mode
STOP pin
VIH
XOUT pin NORMAL mode Enter the STOP mode by programming. STOP mode
Warm-up NORMAL mode
STOP mode
Exit the STOP mode by hardware at the rising edge of the STOP pin input.
Figure 2-8 Edge-Sensitive Exit Mode
Page 24
TMP86PS64FG
The STOP mode is exited in the edge-sensitive exit mode by the following sequence. 1. Oscillations start. In the dual-clock mode, both high-frequency and low-frequency oscillators start to return to the NORMAL2 mode, and only the low-frequency oscillator starts to return to the SLOW mode. In the single-clock mode, only the high-frequency oscillator starts. 2. The warm-up period time is inserted to allow sufficient time for the oscillator to stabilize. During warm-up, internal operations remain halted. 4 types of warming-up period time can be selected in SYSCR1 depending on the characteristics of the oscillator. 3. After the warm-up period time, program execution resumes with the instruction immediately following the instruction that activated the STOP mode.
Note 1: When the STOP mode is exited, the prescalar and divider of the timing generator are cleared to 0. Note 2: The STOP mode is exited by setting the RESET pin to low, that immediately performs the normal reset operation. Note 3: To exit the STOP mode with a low hold voltage, the following cautions must be observed. The power supply voltage must be at the operating voltage level before exiting the STOP mode. The RESET pin must also be high, rising together with the power supply voltage. In this case, if an external time constant circuit is connected, the RESET pin input voltage increases at a slower pace than the power supply voltage. At this time, there is a danger that a reset may occur if the input voltage level of the RESET pin drops below the non-inverting high-level input voltage (hysteresis input).
Table 2-5 Warm-up Time (fc = 16.0 MHz, fs = 32.768 kHz)
Warm-up time [ms] WUT Return to the NORMAL mode Return to the SLOW mode DV1CK=0 00 01 10 11 12.288 4.096 3.072 1.024 DV1CK=1 24.576 8.192 6.144 2.048 750 250 5.85 1.95
Note 1: Since the warm-up period time is obtained by dividing the basic clock by the divider, any frequency fluctuations will lead to small warm-up period time error. The warm-up period time should be considered as an approximate value.
Page 25
2.2 System Clock Controller
2. Operational Descriptions
Oscillator
Oscillated
Stopped
Main system clock a+3 Stopped
Program counter SET (SYSCR1).7
a+2
Instruction execution n+1 n+2 n+3 n+4
Divider
n
0
(a) Entering the STOP mode (activated with SET (SYSCR1).7 instruction located at address a)
Figure 2-9 Entering and Exiting the STOP Mode
a+3 a+4 a+5 Instruction at a+2 address Instruction at a+3 address 0 1 (b) Exiting the STOP mode 2 3
Page 26
Warm-up
STOP pin input
Oscillator Stopped
Oscillated
Main system clock a+6
Program counter
Instruction Stopped execution
Instruction at a+4 address
Divider
0
Count up
TMP86PS64FG
TMP86PS64FG
2.2.4.2
IDLE1/2 and SLEEP1/2 Modes
The IDLE1/2 and SLEEP1/2 modes controlled by the system control register 2 (SYSCR2) and maskable interrupts. The following status is held during the IDLE1/2 or SLEEP1/2 mode. 1. The CPU and watchdog timer are halted. On-chip peripherals continue operation. 2. The data memory, registers, program status words, port output latches hold the status that activated the IDLE1/2 or SLEEP1/2 mode. 3. The program counter holds the address of the instruction after next to the instruction to activate IDLE1/2 or SLEEP1/2 mode.
Entering the IDLE1/2 or SLEEP1/2 mode (Instruction)
CPU and WDT halted
Reset input No No
Yes
Reset
Interrupt request Yes
No (Normal execution)
IMF = "1" Yes (Interrupt service routine)
Interrupt processing
Execution of the instruction immediately following the instruction that activated the IDLE1/2 or SLEEP1/2 mode
Figure 2-10 IDLE1/2 and SLEEP1/2 Modes
Page 27
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
* Entering IDLE1/2 or SLEEP1/2 mode After clearing the interrupt master enable flag (IMF) to 0, set the individual interrupt enable flag used to exit the IDLE1/2 or SLEEP1/2 mode to 1. To enter the EDLE1/2 or SLEEP1/2 mode, set SYSCR2 to 1. * Exiting IDLE1/2 or SLEEP1/2 Mode Upon return from the IDEL1/2 or SLEEP1/2 mode, the interrupt master enable flag (IMF) determines the action taken after exiting the IDLE1/2 or SLEEP1/2 mode; i.e., whether execution resumes with an interrupt service routine. When exiting the IDLE1//2 or SLEEP1/2 mode, SYSCR2 is automatically cleared to 0, and the operating mode is returned to the mode before entering the IDLE1/2 or SLEEP1/2 mode. The IDLE1/2 or SLEEP1/2 mode is exited by setting the RESET pin to low. In this case, the NORMAL1 mode is activated after exitig the IDLE1/2 or SLEEP1/2. (1) Program execution resuming with the instruction (IMF = 0) The IDLE1/2 or SLEEP1/2 mode is exited by the individual interrupt enable flag (EF). Program execution resumes with the instruction immediately following the instruction that activated the IDLE1/2 or SLEEP1/2 mode. Normally the instruction latches (IL) of the interrupt source used to exit the IDLE1/2 or SLEEP1/2 mode must be cleared to 0 by the load instruction. (2) Program execution resuming with the interrupt service routine (IMF = 1) The IDEL1/2 or SLEEP1/2 mode is exited by an interrupt source enabled by the individual interrupt enable flag (EF). Execution resumes with the interrupt service routine. Upon completion of the interrupt service routine, program execution resumes with the instruction immediately following the instruction that activated the IDEL1/2 or SLEEP1/2 mode.
Note: When a watchdog timer interrupt is generated immediately before entering the IDEL1/2 or SLEEP1/2 mode, the watchdog timer interrupt is processed without entering the IDEL1/2 or SLEEP1/2 mode.
Page 28
Main system clock
Interrupt request a+2 a+3 Stopped
Program counter SET(SYSCR2).4
Instruction execution
Watchdog timer
Operated
(a) Entering the IDLE1/2 or SLEEP1/2 mode (activated with SET(SYSCR1).4 instruction located at address a)
Main system clock
Interrupt request a+3 a+4
Figure 2-11 Entering and Exiting the IDLE1/2 or SLEEP1/2 Mode
Instruction at a+2 address Operated a+3 Interrupt accepted Operated
Page 29
Program counter
Instruction execution
Stopped
Watchdog timer
Stopped
1. Normal execution
Main system clock
Interrupt request
Program counter
Instruction execution
Stopped
TMP86PS64FG
Watchdog timer
Stopped
2. Interrupt service routine (b) Exiting the IDLE1/2 or SLEEP1/2 mode
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
2.2.4.3
IDLE0 and SLEEP0 Modes
The IDLE0 mode is controlled by the system control register 2 (SYSCR2) and time base timer. The following status is held during the IDLE0 mode. * The timing generator stops the clock distribution to the on-chip peripherals except the time base timer. * The data memory, registers, program status words and port output latches hold the status that activated the IDLE0 or SLEEP0 mode. * The program counter holds the address of the instruction after next to the instruction to activate the IDLE0 or SLEEP0 mode.
Note: Before entering the IDLE0 or SLEEP0 mode, the on-chip peripherals must be disabled.
Stopping operations of the on-chip functions (Instruction)
Entering the IDLE0 or SLEEP0 mode (Instruction)
CPU and WDT halted
Reset input No No
Yes
Reset
Falling the TBT source clock
Yes "0" TBTCR "1" No (Normal execution) No TBT interrupt enabled Yes IMF = "1" Yes (Interrupt service routine)
Interrupt processing
Execution of the instruction immediately following the instruction that activated the IDLE0 or SLEEP0 mode
Figure 2-12 IDLE0 or SLEEP0 Mode
Page 30
TMP86PS64FG
* Entering IDLE0 or SLEEP0 mode Disable on-chip peripherals such as a timer counter. To enter the IDLE0 or SLEEP0 mode, set SYSCR2 to 1. * Exiting IDLE0 or SLEEP0 Mode Upon return from the IDEL0 or SLEEP0 mode, the interrupt master enable flag (IMF) determines the action taken after exiting the IDEL0 or SLEEP0 mode; i.e., whether execution resumes with an interrupt service routine. When exiting the IDEL0 or SLEEP0 mode, SYSCR2 is automatically cleared to 0, and the operating mode is returned to the mode before entering the IDEL0 or SLEEP0 mode. When TBTCR is set to 1 at this time. the INTTBT interrupt latch is set. The IDLE0 or SLEEP0 mode is exited by setting the RESET pin to low. In this case, the NORMAL1 mode is activated after exiting the IDLE1/2 or SLEEP1/2.
Note: The IDLE0 or SLEEP0 mode is entered and exited regardless of TBTCR setting.
(1)
Program execution resuming with the instruction (IMF, EF8, TBTCR = 0) When detecting the falling edge of the source clock set in TBTCR, the IDLE0 or SLEEP0 mode is exited. When the IDLE0 or SLEEP0 mode is exited, program execution resumes with the instruction immediately following the instruction that activated the IDLE0 or SLEEP0 mode. When TBTCR is set to 1, the time base timer interrupt latch is set.
(2)
Program execution resuming with the interrupt service routine (IMF, EF8, TBTCR = 1) When detecting the falling edge of the source clock set in TBTCR, the IDLE0 or SLEEP0 mode is exited, and then INTTBT interrupt processing is performed.
Note 1: The IDLE0 or SLEEP0 mode is returned to the NORMAL1 or SLEEP1 mode by the asynchronous internal clock specified in TBTCR, the period time of IDLE0 or SLEEP0 mode is shorter than the period set in TBTCR. Note 2: When a watchdog timer interrupt is generated immediately before entering the IDLE1/2 or SLEEP1/2 mode, the watchdog timer interrupt is processed, without entering the IDLE1/2 or SLEEP1/2 mode. Note 3: When IL8ER in interrupt source selector (INTSEL) is set to "1", the program execution resumes with the instruction immediately following the instruction that activated the IDLE0 or SLEEP0 mode even though all of IMF, EF8 and TBTCR are set to "1".
Page 31
Main system clock
2.2 System Clock Controller
2. Operational Descriptions
Interrupt request
Program counter
a+2
a+3
Instruction execution
SET(SYSCR2).2
Stopped
Watchdog timer
Operated
(a) Entering the IDLE0 or SLEEP0 mode (activated with SET(SYSCR2).4 instruction located at address a)
Main system clock
TBT souce clock
Figure 2-13 Entering and Exiting the IDLE0 or SLEEP0 Mode
a+3
a+4
Instruction at a+2 address
Operated
a+3
Interrupt accepted
Operated
Page 32
Program counter
Instruction execution
Stopped
Watchdog timer
Stopped
1. Normal execution
Main system clock
TBT souce clock
Program counter
Instruction execution
Stopped
Watchdog timer
Stopped
TMP86PS64FG
2. Interrupt service routine (b) Exiting the IDLE0 or SLEEP0 mode
TMP86PS64FG
2.2.4.4
SLOW Mode
The SLOW mode is controlled by the system control register 2 (SYSCR2). (1) Switching the NORMAL2 mode to SLOW mode Write 1 to SYSCR2 to switch the main system clock to the low-frequency clock. Clear SYSCR2 to 0 to stop the high-frequency oscillator.
Note: The high-frequency clock oscillation can be continued to return quickly to the NORMAL2 mode. To enter the STOP mode from the SLOW mode, the high-frequency clock must be stopped.
When the low-frequency clock oscillation is unstable, wait until the oscillation is stabilized before performing the above operation. The TimerCounter (TC2) is convenient to check the low-frequency clock oscillation stability.)
Example 1 :Switching from the NORMAL2 mode to SLOW1 mode.
SET CLR (SYSCR2) . 5 (SYSCR2) . 7 : SYSCR21 : (switches the system clock to the low-frequency clock for the SLOW2 mode.) : SYSCR20(stops the high-frequency oscillation.)
Example 2 :Switching to the SLOW1 mode after checking the low-frequency clock oscillation stability with TC2
SET LD LDW DI SET EI SET | PINTTC2: CLR SET CLR RETI | VINTTC2: DW PINTTC2 : INTTC2 vector table (TC2CR). 5 (SYSCR2). 5 (SYSCR2). 7 : stops INTTC2. : SYSCR21 : (switches the system clock to the low-frequency clock.) : SYSCR20(stops the high-frequency clock.) (TC2CR). 5 (EIRH). 4 (SYSCR2). 6 (TC2CR), 14H (TC2DRL), 8000H : SYSCR21 : (starts low-frequency oscillation.) : sets the mode for TC2. :sets the warm-up time. : (determines the time depending on the resonator.) : IMF0 : enables the INTTC2. : IMF1 : starts INTTC2.
Page 33
2. Operational Descriptions
2.2 System Clock Controller TMP86PS64FG
(2)
Switching from the SLOW1 mode to NORMAL2 mode
First, set SYSCR2 to 1 to oscillate the high-frequency clock. After the warm-up period time required to assure oscillation stability with the TimerCounter (TC2) has elapsed, clear SYSCR2 to 0 to switch the system clock to the high-frequency clock. The SLOW mode is also exited by setting the RESET pin to low, which immediately performs normal reset operation. The NORMAL1 mode is entered after a reset release.
Note: After SYSCK is cleared to 0, instructions are executed continuously by the low-frequency clock during synchronization period for high-frequency and low-frequency clocks.
High-frequency clock fc
Low-frequency clock fc
Main system clock
SYSCK
Example :Switching from SLOW1 mode to NORMAL2 mode with TC2 (fc = 16 MHz, warm-up time = 4.0 ms)
SET LD LD DI SET EI SET | PINTTC2 CLR CLR RETI | VINTTC2: DW PINTTC2 : INTTC2 vector table (TC2CR). 5 (SYSCR2). 5 : stops TC2. : SYSCR20 : (switches the system clock to the high-frequency clock.) (TC2CR). 5 (EIRH). 4 (SYSCR2) . 7 (TC2CR), 10H (TC2DRH), 0F8H : SYSCR21 :(starts high-frequency oscillation.) : sets the TC2 mode. : sets the warm-up time. : (determines the time depending on the frequency and resonator.) : IMF0 : enables INTTC2 interrupt. : IMF1 : starts TC2.
Page 34
Highfrequency clock
Oscillation stopped
Lowfrequency clock
Main system clock
SYSCK
XEN
Instruction execution
SET (SYSCR2).5 SLOW2 mode (a) Switching to the SLOW1 mode
CLR (SYSCR2).7 SLOW mode
NORMAL2 mode
Figure 2-14 Switching between SLOW and NORMAL2 Modes
CLR (SYSCR2).5 Warm-up in SLOW2 mode (b) Switching to the NORMAL2 mode
Page 35
Highfrequency clock
Lowfrequency clock
Main system clock
SYSCK
XEN
Instruction execution
SET (SYSCR2).7
SLOW1 mode
NORMAL2 mode
TMP86PS64FG
2. Operational Descriptions
2.3 Reset Circuit TMP86PS64FG
2.3 Reset Circuit
TMP86PS64FG has four types of reset, that are an external reset, address trap reset, watchdog timer reset and system clock reset.
An address trap reset, watchdog timer reset and system clock reset are internal factor resets. When detecting these reset requests, TMP86PS64FG is in the reset state during a maximum of 24/fc [s]. (During a flash reset, the RESET pin is held high.)
Since the internal factor reset circuits that are watchdog timer reset, address trap reset and system clock reset are not initialized upon power-up, a maximum reset time may become 24/fc [s] (1.5 s @ 16.0 MHz). Table 2-6 shows the on-chip hardware initialization by reset operation. Table 2-6 On-Chip Hardware Initialization by Reset Operation
On-Chip Hardware Program counter (PC) Stack pointer (SP) General-purpose register (W, A, B, C, D, E, H, L, IX, IY) Jump status flag (JF) Zero flag (ZF) Carry flag (CF) Half carry flag (HF) Sign flag (SF) Overflow flag (VF) Interrupt master enable flag (IMF) Interrupt individual enable flag (EF) Interrupt latch (IL) Initial Value (FFFEH) Not initialized Not initialized Not initialized Not initialized Not initialized Not initialized Output latch of I/O port Not initialized Not initialized 0 0 Control register 0 RAM Refer to description of each register Not initialized Refer to description of each I/O port Watchdog timer Enabled Prescaler and divider of the timing generator 0 On-Chip Hardware Initial Value
2.3.1
External Reset Input
The RESET pin is the hysteresis input with pull-up resistance. When the RESET pin is held low for a minimum of 3 machine cycles (12/fc [s]) with the power supply voltage within the operating voltage range and stable oscillation, a reset is triggered and internal state is initialized. When the RESET pin input goes high, the reset operation is released , and program execution starts at the vector address stored at addresses FFFE to FFFH.
Page 36
TMP86PS64FG
VDD
RESET
Reset input Watchdog timer Internal factor reset output circuit Address trap detection System clock detection
Figure 2-15 Reset Circuit 2.3.2 Address-Trap-Reset
If the CPU runs away due to spurious noises and attempts to fetch an instruction form the on-chip RAM (WDTCR1 = 1) or the SFR area, an address-trap-reset is generated. The reset time is a maximum of 24/ fc [s] (1.5 s @16.0 MHz). If the CPU runs away due to spurious noises and attempts to fetch an instruction from the on-chip RAM (WDTCR1 = 1), the DBR or the SFR area, an address-trap-reset is generated. The reset time is a maximum of 24/fc [s] (1.5 s @16.0 MHz).
Note:Either a reset or an interrupt can be selected for an address-trap. An address-trap area can be specified.
Instruction execution Internal reset signal
JP
a An address-trap is generated
Reset released
Instruction at r address
max 24/fc [s]
4/fc to 12/fc [s]
16/fc [s]
Note 1: "a" is the address in on-chip RAM (WDTCR1=1), SFR or DBR area. Note 2: During the reset release process, the reset vector "r" is read out, and an instruction at the address "r" is fetched and decoded.
Figure 2-16 Address Trap Reset 2.3.3 Watchdog Timer Reset
Refer to "Watchdog Timer".
2.3.4
System Clock Reset
Either one of the following conditions is met, a system clock reset is generated automatically to prevent the CPU to be in the deadlock condition. (Oscillation is continued.) * SYSCR2 and SYSCR2 are cleared to 0. * SYSCR2 is cleared to 0 when SYSCR2 = 0. * SYSCR2 is cleared to 0 when SYSCR2 = 1. The reset time is a maximum of 24/fc [s] (1.5 s @160.0 MHz).
Page 37
2. Operational Descriptions
2.3 Reset Circuit TMP86PS64FG
Page 38
TMP86PS64FG
3. Interrupt Control Circuit
The TMP86PS64FG has a total of 21 interrupt sources excluding reset, of which 5 source levels are multiplexed. Interrupts can be nested with priorities. Four of the internal interrupt sources are non-maskable while the rest are maskable. Interrupt sources are provided with interrupt latches (IL), which hold interrupt requests, and independent vectors. The interrupt latch is set to "1" by the generation of its interrupt request which requests the CPU to accept its interrupts. Interrupts are enabled or disabled by software using the interrupt master enable flag (IMF) and interrupt enable flag (EF). If more than one interrupts are generated simultaneously, interrupts are accepted in order which is dominated by hardware. However, there are no prioritized interrupt factors among non-maskable interrupts.
Interrupt Latch - - - IL2 IL3 IL4 IL5 IL6 IL7 IL8 Vector Address FFFE FFFC FFFC FFFA FFF8 FFF6 FFF4 FFF2 FFF0 FFEE
Interrupt Factors Internal/External Internal Internal Internal Internal External External Internal Internal Internal External Internal External Internal Internal Internal Internal External Internal External Internal Internal (Reset) INTSWI (Software interrupt) INTUNDEF (Executed the undefined instruction interrupt) INTATRAP (Address trap interrupt) INTWDT (Watchdog timer interrupt)
INT0
Enable Condition Non-maskable Non-maskable Non-maskable Non-maskable Non-maskable IMF* EF4 = 1, INT0EN = 1 IMF* EF5 = 1 IMF* EF6 = 1 IMF* EF7 = 1 IMF* EF8 = 1, IL8ER = 0 IMF* EF8 = 1, IL8ER = 1 IMF* EF9 = 1, IL9ER = 0 IMF* EF9 = 1, IL9ER = 1 IMF* EF10 = 1 IMF* EF11 = 1 IMF* EF12 = 1 IMF* EF13 = 1, IL13ER = 0 IMF* EF13 = 1, IL13ER = 1 IMF* EF14 = 1, IL14ER = 0 IMF* EF14 = 1, IL14ER = 1 IMF* EF15 = 1, IL15ER = 0 IMF* EF15 = 1, IL15ER = 1
Priority 1 2 2 2 2 5 6 7 8 9
INT1 INTTC4 INTTC5 INTTBT INT2 INTTC1 INT3 INTTC3 INTTC6 INTTC2 INTSIO1 INT4 INTTRX
INT5
IL9
FFEC
10
IL10 IL11 IL12 IL13
FFEA FFE8 FFE6 FFE4
11 12 13 14
IL14
FFE2
15
INTADC INTSIO2
IL15
FFE0
16
Note 1: The INTSEL register is used to select the interrupt source to be enabled for each multiplexed source level (see 3.3 Interrupt Source Selector (INTSEL)). Note 2: To use the address trap interrupt (INTATRAP), clear WDTCR1 to "0" (It is set for the "reset request" after reset is cancelled). For details, see "Address Trap". Note 3: To use the watchdog timer interrupt (INTWDT), clear WDTCR1 to "0" (It is set for the "Reset request" after reset is released). For details, see "Watchdog Timer".
3.1 Interrupt latches (IL15 to IL2)
An interrupt latch is provided for each interrupt source, except for a software interrupt and an executed the undefined instruction interrupt. When interrupt request is generated, the latch is set to "1", and the CPU is requested to accept the interrupt if its interrupt is enabled. The interrupt latch is cleared to "0" immediately after accepting interrupt. All interrupt latches are initialized to "0" during reset.
Page 39
3. Interrupt Control Circuit
3.2 Interrupt enable register (EIR) TMP86PS64FG
The interrupt latches are located on address 003CH and 003DH in SFR area. Each latch can be cleared to "0" individually by instruction. However, IL2 and IL3 should not be cleared to "0" by software. For clearing the interrupt latch, load instruction should be used and then IL2 and IL3 should be set to "1". If the read-modify-write instructions such as bit manipulation or operation instructions are used, interrupt request would be cleared inadequately if interrupt is requested while such instructions are executed. Interrupt latches are not set to "1" by an instruction. Since interrupt latches can be read, the status for interrupt requests can be monitored by software.
Note: In main program, before manipulating the interrupt enable flag (EF) or the interrupt latch (IL), be sure to clear IMF to "0" (Disable interrupt by DI instruction). Then set IMF newly again as required after operating on the EF or IL (Enable interrupt by EI instruction) In interrupt service routine, because the IMF becomes "0" automatically, clearing IMF need not execute normally on interrupt service routine. However, if using multiple interrupt on interrupt service routine, manipulating EF or IL should be executed before setting IMF="1".
Example 1 :Clears interrupt latches
DI LDW EI (ILL), 1110100000111111B ; IMF 0 ; IL12, IL10 to IL6 0 ; IMF 1
Example 2 :Reads interrupt latchess
LD WA, (ILL) ; W ILH, A ILL
Example 3 :Tests interrupt latches
TEST JR (ILL). 7 F, SSET ; if IL7 = 1 then jump
3.2 Interrupt enable register (EIR)
The interrupt enable register (EIR) enables and disables the acceptance of interrupts, except for the non-maskable interrupts (Software interrupt, undefined instruction interrupt, address trap interrupt and watchdog interrupt). Nonmaskable interrupt is accepted regardless of the contents of the EIR. The EIR consists of an interrupt master enable flag (IMF) and the individual interrupt enable flags (EF). These registers are located on address 003AH and 003BH in SFR area, and they can be read and written by an instructions (Including read-modify-write instructions such as bit manipulation or operation instructions).
3.2.1
Interrupt master enable flag (IMF)
The interrupt enable register (IMF) enables and disables the acceptance of the whole maskable interrupt. While IMF = "0", all maskable interrupts are not accepted regardless of the status on each individual interrupt enable flag (EF). By setting IMF to "1", the interrupt becomes acceptable if the individuals are enabled. When an interrupt is accepted, IMF is cleared to "0" after the latest status on IMF is stacked. Thus the maskable interrupts which follow are disabled. By executing return interrupt instruction [RETI/RETN], the stacked data, which was the status before interrupt acceptance, is loaded on IMF again. The IMF is located on bit0 in EIRL (Address: 003AH in SFR), and can be read and written by an instruction. The IMF is normally set and cleared by [EI] and [DI] instruction respectively. During reset, the IMF is initialized to "0".
Page 40
TMP86PS64FG
3.2.2
Individual interrupt enable flags (EF15 to EF4)
Each of these flags enables and disables the acceptance of its maskable interrupt. Setting the corresponding bit of an individual interrupt enable flag to "1" enables acceptance of its interrupt, and setting the bit to "0" disables acceptance. During reset, all the individual interrupt enable flags (EF15 to EF4) are initialized to "0" and all maskable interrupts are not accepted until they are set to "1".
Note:In main program, before manipulating the interrupt enable flag (EF) or the interrupt latch (IL), be sure to clear IMF to "0" (Disable interrupt by DI instruction). Then set IMF newly again as required after operating on the EF or IL (Enable interrupt by EI instruction) In interrupt service routine, because the IMF becomes "0" automatically, clearing IMF need not execute normally on interrupt service routine. However, if using multiple interrupt on interrupt service routine, manipulating EF or IL should be executed before setting IMF="1".
Example 1 :Enables interrupts individually and sets IMF
DI LDW : : EI ; IMF 1 (EIRL), 1110100010100000B ; IMF 0 ; EF15 to EF13, EF11, EF7, EF5 1 Note: IMF should not be set.
Example 2 :C compiler description example
unsigned int _io (3AH) EIRL; _DI(); EIRL = 10100000B; : _EI(); /* 3AH shows EIRL address */
Page 41
3. Interrupt Control Circuit
3.2 Interrupt enable register (EIR) TMP86PS64FG
Interrupt Latches
(Initial value: 00000000 000000**) ILH,ILL (003DH, 003CH) 15 IL15 14 IL14 13 IL13 12 IL12 11 IL11 10 IL10 9 IL9 8 IL8 7 IL7 6 IL6 5 IL5 4 IL4 3 IL3 2 IL2 1 0
ILH (003DH)
ILL (003CH)
IL15 to IL2
Interrupt latches
at RD 0: No interrupt request 1: Interrupt request
at WR 0: Clears the interrupt request 1: (Interrupt latch is not set.)
R/W
Note 1: To clear any one of bits IL7 to IL4, be sure to write "1" into IL2 and IL3. Note 2: In main program, before manipulating the interrupt enable flag (EF) or the interrupt latch (IL), be sure to clear IMF to "0" (Disable interrupt by DI instruction). Then set IMF newly again as required after operating on the EF or IL (Enable interrupt by EI instruction) In interrupt service routine, because the IMF becomes "0" automatically, clearing IMF need not execute normally on interrupt service routine. However, if using multiple interrupt on interrupt service routine, manipulating EF or IL should be executed before setting IMF="1". Note 3: Do not clear IL with read-modify-write instructions such as bit operations.
Interrupt Enable Registers
(Initial value: 00000000 0000***0) EIRH,EIRL (003BH, 003AH) 15 EF15 14 EF14 13 EF13 12 EF12 11 EF11 10 EF10 9 EF9 8 EF8 7 EF7 6 EF6 5 EF5 4 EF4 EIRL (003AH) 3 2 1 0 IMF
EIRH (003BH)
EF15 to EF4 IMF
Individual-interrupt enable flag (Specified for each bit) Interrupt master enable flag
0: 1: 0: 1:
Disables the acceptance of each maskable interrupt. Enables the acceptance of each maskable interrupt. Disables the acceptance of all maskable interrupts Enables the acceptance of all maskable interrupts
R/W
Note 1: *: Don't care Note 2: Do not set IMF and the interrupt enable flag (EF15 to EF4) to "1" at the same time. Note 3: In main program, before manipulating the interrupt enable flag (EF) or the interrupt latch (IL), be sure to clear IMF to "0" (Disable interrupt by DI instruction). Then set IMF newly again as required after operating on the EF or IL (Enable interrupt by EI instruction) In interrupt service routine, because the IMF becomes "0" automatically, clearing IMF need not execute normally on interrupt service routine. However, if using multiple interrupt on interrupt service routine, manipulating EF or IL should be executed before setting IMF="1".
Page 42
TMP86PS64FG
3.3 Interrupt Source Selector (INTSEL)
Each interrupt source that shares the interrupt source level with another interrupt source is allowed to enable the interrupt latch only when it is selected in the INTSEL register. The interrupt controller does not hold interrupt requests corresponding to interrupt sources that are not selected in the INTSEL register. Therefore, the INTSEL register must be set appropriately before interrupt requests are generated. The following interrupt sources share their interrupt source level; the source is selected onnthe register INTSEL. 1. INTTBT and INT2 share the interrupt source level whose priority is 9. 2. INTTC1 and INT3 share the interrupt source level whose priority is 10. 3. INTSIO1 and INT4 share the interrupt source level whose priority is 14. 4. INTTRX and INT5 share the interrupt source level whose priority is 15. 5. INTADC and INTSIO2 share the interrupt source level whose priority is 16. Interrupt source selector
INTSEL (003EH) 7 IL8ER 6 IL9ER 5 4 3 2 IL13ER 1 IL14ER 0 IL15ER (Initial value: 00** *000)
IL8ER IL9ER IL13ER IL14ER IL15ER
Selects INTTBT or INT2 Selects INTTC1 or INT3 Selects INTSIO1 or INT4 Selects INTTRX or INT5 Selects INTADC or INTSIO2
0: INTTBT 1: INT2 0: INTTC1 1: INT3 0: INTSIO1 1: INT4 0: INTTRX 1: INT5 0: INTADC 1: INTSIO2
R/W R/W R/W R/W R/W
3.4 Interrupt Sequence
An interrupt request, which raised interrupt latch, is held, until interrupt is accepted or interrupt latch is cleared to "0" by resetting or an instruction. Interrupt acceptance sequence requires 8 machine cycles (2 s @16 MHz) after the completion of the current instruction. The interrupt service task terminates upon execution of an interrupt return instruction [RETI] (for maskable interrupts) or [RETN] (for non-maskable interrupts). Figure 3-1 shows the timing chart of interrupt acceptance processing.
3.4.1
Interrupt acceptance processing is packaged as follows.
a. The interrupt master enable flag (IMF) is cleared to "0" in order to disable the acceptance of any following interrupt. b. The interrupt latch (IL) for the interrupt source accepted is cleared to "0". c. The contents of the program counter (PC) and the program status word, including the interrupt master enable flag (IMF), are saved (Pushed) on the stack in sequence of PSW + IMF, PCH, PCL. Meanwhile, the stack pointer (SP) is decremented by 3. d. The entry address (Interrupt vector) of the corresponding interrupt service program, loaded on the vector table, is transferred to the program counter. e. The instruction stored at the entry address of the interrupt service program is executed.
Note:When the contents of PSW are saved on the stack, the contents of IMF are also saved.
Page 43
3. Interrupt Control Circuit
3.4 Interrupt Sequence TMP86PS64FG
1-machine cycle
Interrupt service task
Interrupt request Interrupt latch (IL)
IMF Execute instruction a-1 Execute instruction Execute instruction
Interrupt acceptance
Execute RETI instruction
PC
a
a+1
a
b
b+1 b+2 b + 3
c+1
c+2
a
a+1 a+2
SP
n
n-1 n-2
n-3
n-2 n-1
n
Note 1: a: Return address entry address, b: Entry address, c: Address which RETI instruction is stored Note 2: On condition that interrupt is enabled, it takes 38/fc [s] or 38/fs [s] at maximum (If the interrupt latch is set at the first machine cycle on 10 cycle instruction) to start interrupt acceptance processing since its interrupt latch is set.
Figure 3-1 Timing Chart of Interrupt Acceptance/Return Interrupt Instruction
Example: Correspondence between vector table address for INTTBT and the entry address of the interrupt service program
Vector table address
Entry address
Interrupt service program
FFEEH FFEFH
03H D2H
Vector
D203H D204H
0FH
06H
Figure 3-2 Vector table address,Entry address
A maskable interrupt is not accepted until the IMF is set to "1" even if the maskable interrupt higher than the level of current servicing interrupt is requested. In order to utilize nested interrupt service, the IMF is set to "1" in the interrupt service program. In this case, acceptable interrupt sources are selectively enabled by the individual interrupt enable flags. To avoid overloaded nesting, clear the individual interrupt enable flag whose interrupt is currently serviced, before setting IMF to "1". As for non-maskable interrupt, keep interrupt service shorten compared with length between interrupt requests; otherwise the status cannot be recovered as non-maskable interrupt would simply nested.
3.4.2
Saving/restoring general-purpose registers
During interrupt acceptance processing, the program counter (PC) and the program status word (PSW, includes IMF) are automatically saved on the stack, but the accumulator and others are not. These registers are saved by software if necessary. When multiple interrupt services are nested, it is also necessary to avoid using the same data memory area for saving registers. The following methods are used to save/restore the generalpurpose registers.
Page 44
TMP86PS64FG
3.4.2.1
Using PUSH and POP instructions
If only a specific register is saved or interrupts of the same source are nested, general-purpose registers can be saved/restored using the PUSH/POP instructions.
Example :Save/store register using PUSH and POP instructions
PINTxx: PUSH WA ; Save WA register (interrupt processing) POP RETI WA ; Restore WA register ; RETURN
Address (Example)
SP
b-5 A
b-4
SP
PCL PCH PSW At acceptance of an interrupt
W PCL
PCH PSW At execution of PUSH instruction
SP
PCL PCH PSW
At execution of POP instruction
b-3 b-2 b-1
SP
b At execution of RETI instruction
Figure 3-3 Save/store register using PUSH and POP instructions
3.4.2.2 Using data transfer instructions
To save only a specific register without nested interrupts, data transfer instructions are available.
Example :Save/store register using data transfer instructions
PINTxx: LD (GSAVA), A ; Save A register (interrupt processing) LD RETI A, (GSAVA) ; Restore A register ; RETURN
Page 45
3. Interrupt Control Circuit
3.4 Interrupt Sequence TMP86PS64FG
Main task
Interrupt acceptance
Interrupt service task Saving registers
Restoring registers
Interrupt return
Saving/Restoring general-purpose registers using PUSH/POP data transfer instruction
Figure 3-4 Saving/Restoring General-purpose Registers under Interrupt Processing 3.4.3 Interrupt return
Interrupt return instructions [RETI]/[RETN] perform as follows.
[RETI]/[RETN] Interrupt Return 1. Program counter (PC) and program status word (PSW, includes IMF) are restored from the stack. 2. Stack pointer (SP) is incremented by 3.
As for address trap interrupt (INTATRAP), it is required to alter stacked data for program counter (PC) to restarting address, during interrupt service program.
Note:If [RETN] is executed with the above data unaltered, the program returns to the address trap area and INTATRAP occurs again.When interrupt acceptance processing has completed, stacked data for PCL and PCH are located on address (SP + 1) and (SP + 2) respectively.
Example 1 :Returning from address trap interrupt (INTATRAP) service program
PINTxx: POP LD PUSH WA WA, Return Address WA ; Recover SP by 2 ; ; Alter stacked data
(interrupt processing) RETN ; RETURN
Example 2 :Restarting without returning interrupt (In this case, PSW (Includes IMF) before interrupt acceptance is discarded.)
PINTxx: INC INC INC SP SP SP ; Recover SP by 3 ; ;
(interrupt processing) LD JP EIRL, data Restart Address ; Set IMF to "1" or clear it to "0" ; Jump into restarting address
Interrupt requests are sampled during the final cycle of the instruction being executed. Thus, the next interrupt can be accepted immediately after the interrupt return instruction is executed.
Page 46
TMP86PS64FG
Note 1: It is recommended that stack pointer be return to rate before INTATRAP (Increment 3 times), if return interrupt instruction [RETN] is not utilized during interrupt service program under INTATRAP (such as Example 2). Note 2: When the interrupt processing time is longer than the interrupt request generation time, the interrupt service task is performed but not the main task.
3.5 Software Interrupt (INTSW)
Executing the SWI instruction generates a software interrupt and immediately starts interrupt processing (INTSW is highest prioritized interrupt). Use the SWI instruction only for detection of the address error or for debugging.
3.5.1
Address error detection
FFH is read if for some cause such as noise the CPU attempts to fetch an instruction from a non-existent memory address during single chip mode. Code FFH is the SWI instruction, so a software interrupt is generated and an address error is detected. The address error detection range can be further expanded by writing FFH to unused areas of the program memory. Address trap reset is generated in case that an instruction is fetched from RAM, DBR or SFR areas.
3.5.2
Debugging
Debugging efficiency can be increased by placing the SWI instruction at the software break point setting address.
3.6 Undefined Instruction Interrupt (INTUNDEF)
Taking code which is not defined as authorized instruction for instruction causes INTUNDEF. INTUNDEF is generated when the CPU fetches such a code and tries to execute it. INTUNDEF is accepted even if non-maskable interrupt is in process. Contemporary process is broken and INTUNDEF interrupt process starts, soon after it is requested.
Note: The undefined instruction interrupt (INTUNDEF) forces CPU to jump into vector address, as software interrupt (SWI) does.
3.7 Address Trap Interrupt (INTATRAP)
Fetching instruction from unauthorized area for instructions (Address trapped area) causes reset output or address trap interrupt (INTATRAP). INTATRAP is accepted even if non-maskable interrupt is in process. Contemporary process is broken and INTATRAP interrupt process starts, soon after it is requested.
Note: The operating mode under address trapped, whether to be reset output or interrupt processing, is selected on watchdog timer control register (WDTCR).
3.8 External Interrupts
The TMP86PS64FG has 6 external interrupt inputs. These inputs are equipped with digital noise reject circuits (Pulse inputs of less than a certain time are eliminated as noise). Edge selection is also possible with INT1 to INT4. The INT0/P10 pin can be configured as either an external interrupt input pin or an input/output port, and is configured as an input port during reset. Edge selection, noise reject control and INT0/P10 pin function selection are performed by the external interrupt control register (EINTCR).
Page 47
3. Interrupt Control Circuit
3.8 External Interrupts TMP86PS64FG
Source
Pin
Enable Conditions
Release Edge (level)
Digital Noise Reject Pulses of less than 2/fc [s] are eliminated as noise. Pulses of 7/fc [s] or more are considered to be signals. In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals. Pulses of less than 15/fc or 63/fc [s] are eliminated as noise. Pulses of 49/fc or 193/fc [s] or more are considered to be signals.(at CGCR=0). In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals. Pulses of less than 7/fc [s] are eliminated as noise. Pulses of 25/fc [s] or more are considered to be signals.(at CGCR=0). In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals. Pulses of less than 7/fc [s] are eliminated as noise. Pulses of 25/fc [s] or more are considered to be signals.(at CGCR=0). In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals. Pulses of less than 7/fc [s] are eliminated as noise. Pulses of 25/fc [s] or more are considered to be signals.(at CGCR=0). In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals. Pulses of less than 2/fc [s] are eliminated as noise. Pulses of 7/fc [s] or more are considered to be signals. In the SLOW or the SLEEP mode, pulses of less than 1/fs [s] are eliminated as noise. Pulses of 3.5/fs [s] or more are considered to be signals.
INT0
INT0
IMF
EF4
INT0EN=1
Falling edge
INT1
INT1
IMF
EF5 = 1
Falling edge or Rising edge
INT2
INT2
IMF EF8 = 1 and IL8ER=1
Falling edge or Rising edge
INT3
INT3
IMF and
EF9 = 1
IL9ER=1
Falling edge or Rising edge
INT4
INT4
IMF EF13 = 1 and IL13ER=1
Falling edge, Rising edge, Falling and Rising edge or H level
INT5
INT5
IMF EF14 = 1 and IL14ER=1
Falling edge
Note 1: In NORMAL1/2 or IDLE1/2 mode, if a signal with no noise is input on an external interrupt pin, it takes a maximum of "signal establishment time + 6/fs[s]" from the input signal's edge to set the interrupt latch. Note 2: When INT0EN = "0", IL4 is not set even if a falling edge is detected on the INT0 pin input. Note 3: When a pin with more than one function is used as an output and a change occurs in data or input/output status, an interrupt request signal is generated in a pseudo manner. In this case, it is necessary to perform appropriate processing such as disabling the interrupt enable flag.
Page 48
TMP86PS64FG
External Interrupt Control Register
EINTCR (0037H) 7 INT1NC 6 INT0EN 5 INT4ES 4 3 INT3ES 2 INT2ES 1 INT1ES 0 (Initial value: 0000 000*)
INT1NC INT0EN
Noise reject time select P10/INT0 pin configuration
0: Pulses of less than 63/fc [s] are eliminated as noise 1: Pulses of less than 15/fc [s] are eliminated as noise 0: P10 input/output port 1: INT0 pin (Port P10 should be set to an input mode) 00: Rising edge 01: Falling edge 10: Rising edge and Falling edge 11: H level 0: Rising edge 1: Falling edge 0: Rising edge 1: Falling edge 0: Rising edge 1: Falling edge
R/W R/W
INT4 ES
INT4 edge select
R/W
INT3 ES INT2 ES INT1 ES
INT3 edge select INT2 edge select INT1 edge select
R/W R/W R/W
Note 1: fc: High-frequency clock [Hz], *: Don't care Note 2: When the system clock frequency is switched between high and low or when the external interrupt control register (EINTCR) is overwritten, the noise canceller may not operate normally. It is recommended that external interrupts are disabled using the interrupt enable register (EIR). Note 3: The maximum time from modifying INT1NC until a noise reject time is changed is 26/fc. Note 4: In case RESET pin is released while the state of INT4 pin keeps "H" level, the external interrupt 4 request is not generated even if the INT4 edge select is specified as "H" level. The rising edge is needed after RESET pin is released.
Page 49
3. Interrupt Control Circuit
3.8 External Interrupts TMP86PS64FG
Page 50
TMP86PS64FG
4. Special Function Register (SFR)
The TMP86PS64FG adopts the memory mapped I/O system, and all peripheral control and data transfers are performed through the special function register (SFR) or the data buffer register (DBR). The SFR is mapped on address 0000H to 003FH, DBR is mapped on address 0F80H to 0FFFH. This chapter shows the arrangement of the special function register (SFR) and data buffer register (DBR) for TMP86PS64FG.
4.1 SFR
Address 0000H 0001H 0002H 0003H 0004H 0005H 0006H 0007H 0008H 0009H 000AH 000BH 000CH 000DH 000EH 000FH 0010H 0011H 0012H 0013H 0014H 0015H 0016H 0017H 0018H 0019H 001AH 001BH 001CH 001DH 001EH 001FH 0020H 0021H 0022H 0023H 0024H 0025H UARTSR RDBUF Reserved Reserved TC1DRAL TC1DRAH TC1DRBL TC1DRBH TC2DRL TC2DRH TC3DRB TC3CR TC2CR TC4CR TC5CR TC6CR TC6DR TC4DR TC5DR IRDACR UARTCR1 UARTCR2 TDBUF P4PRD P3CR P4CR P5CR ADCCR1 ADCCR2 TC3DRA Read P0DR P1DR P2DR P3DR P4DR P5DR P6DR P7DR P0CR P1CR Write
Page 51
4. Special Function Register (SFR)
4.1 SFR TMP86PS64FG
Address 0026H 0027H 0028H 0029H 002AH 002BH 002CH 002DH 002EH 002FH 0030H 0031H 0032H 0033H 0034H 0035H 0036H 0037H 0038H 0039H 003AH 003BH 003CH 003DH 003EH 003FH
Read ADCDR2 ADCDR1 SIO1SR SCISEL Reserved P2PRD P4OED P6CR P7CR CGCR TC1CR Reserved TBTCR EINTCR SYSCR1 SYSCR2 EIRL EIRH ILL ILH INTSEL PSW
Write SIO1CR1 SIO1CR2
-
STOPCR
WDTCR1 WDTCR2
Note 1: Do not access reserved areas by the program. Note 2: - ; Cannot be accessed. Note 3: Write-only registers and interrupt latches cannot use the read-modify-write instructions (Bit manipulation instructions such as SET, CLR, etc. and logical operation instructions such as AND, OR, etc.).
Page 52
TMP86PS64FG
4.2 DBR
Address 0F80H 0F81H 0F82H 0F83H 0F84H 0F85H 0F86H 0F87H 0F88H 0F89H 0F8AH 0F8BH 0F8CH 0F8DH 0F8EH 0F8FH 0F90H 0F91H 0F92H 0F93H 0F94H 0F95H 0F96H 0F97H 0F98H 0F99H 0F9AH 0F9BH 0F9CH 0F9DH 0F9EH 0F9FH Read Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved SIO1BR0 SIO1BR1 SIO1BR2 SIO1BR3 SIO1BR4 SIO1BR5 SIO1BR6 SIO1BR7 SIO2BR0 SIO2BR1 SIO2BR2 SIO2BR3 SIO2BR4 SIO2BR5 SIO2BR6 SIO2BR7 Write
Page 53
4. Special Function Register (SFR)
4.2 DBR TMP86PS64FG
Address 0FA0H 0FA1H 0FA2H 0FA3H 0FA4H 0FA5H 0FA6H 0FA7H 0FA8H 0FA9H 0FAAH 0FABH 0FACH 0FADH 0FAEH 0FAFH 0FB0H 0FB1H 0FB2H 0FB3H 0FB4H 0FB5H 0FB6H 0FB7H 0FB8H 0FB9H 0FBAH 0FBBH 0FBCH 0FBDH 0FBEH 0FBFH
Read Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved P8DR P9DR P8CR P9CR SIO2SR PADR PBDR PACR PBCR PAPU PBPU P6PU P7PU Reserved Reserved
Write
SIO2CR1 SIO2CR2
Address 0FC0H :: 0FDFH
Read Reserved :: Reserved
Write
Address 0FE0H :: 0FFFH
Read Reserved :: Reserved
Write
Note 1: Do not access reserved areas by the program. Note 2: - ; Cannot be accessed. Note 3: Write-only registers and interrupt latches cannot use the read-modify-write instructions (Bit manipulation instructions such as SET, CLR, etc. and logical operation instructions such as AND, OR, etc.).
Page 54
TMP86PS64FG
5. I/O Ports
The TMP86PS64FG have 12 parallel input/output ports (91 pins) as follows. 1. Port P0 (8-bit I/O port) 2. Port P1 (8-bit I/O port) * External interrupt input, timer/counter input, divider output. 3. Port P2 (3-bit I/O port) * External interrupt input, STOP mode release signal input. 4. Port P3 (8-bit I/O port) * Timer/counter input, serial interface input/output. 5. Port P4 (8-bit I/O port) * Timer/counter input, serial interface input/output, external interrupt input. 6. Port P5 (8-bit I/O port) 7. Port P6 (8-bit I/O port) * Analog input. 8. Port P7 (8-bit I/O port) * Analog input, STOP mode release signal input. 9. Port P8 (8-bit I/O port) 10. Port P9 (8-bit I/O port) 11. Port PA (8-bit I/O port) 12. Port PB (8-bit I/O port) Each output port contains a latch, which holds the output data. All input ports do not have latches, so the external input data should be externally held until the input data is read from outside or reading should be performed several timer before processing. Figure 5-1 shows input/output timing examples. External data is read from an I/O port in the S1 state of the read cycle during execution of the read instruction. This timing cannot be recognized from outside, so that transient input such as chattering must be processed by the program. Output data changes in the S2 state of the write cycle during execution of the instruction which writes to an I/O port.
Fetch cycle
Instruction execution cycle Input strobe
Fetch cycle
Read cycle
S0 S1 S2 S3 S0 S1 S2 S3 S0 S1 S2 S3
Ex: LD A, (x)
Data input
(a) Input timing
Fetch cycle
Instruction execution cycle Output strobe
Fetch cycle
Write cycle
S0 S1 S2 S3 S0 S1 S2 S3 S0 S1 S2 S3
Ex: LD (x), A
Data output
(b) Output timing
Note: The positions of the read and write cycles may vary, depending on the instruction.
Figure 5-1 Input/Output Timing (Example)
Page 55
5. I/O Ports
TMP86PS64FG
5.1 Port P0 (P07 to P00)
Port P0 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P0 input/output control register (P0CR). During reset, the P0CR is initialized to "0", which configures port P0 as an input. The P0 output latches are also initialized to "0".
STOP OUTEN
P0CRi Data input
Data output
D
Q
P0i
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-2 Port P0
P0DR (0000H)
7 P07
6 P06
5 P05
4 P04
3 P03
2 P02
1 P01
0 P00 (Initial value: 0000 0000)
P0CR (0008H)
7 P0CR7
6 P0CR6
5 P0CR5
4 P0CR4
3 P0CR3
2 P0CR2
1 P0CR1
0 P0CR0 (Initial value: 0000 0000)
P0CR
I/O control for port P0 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 56
TMP86PS64FG
5.2 Port P1 (P17 to P10)
Port P1 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P1 input/output control register (P1CR). During reset, the P1CR is initialized to "0", which configures port P1 as an input mode. The P1 output latches are also initialized to "0". It is also used as INT0, INT1, INT2/TC1, TC2, DVO and PPG. When used as secondary function pin, the input pins (INT0, INT1, INT2, TC1,TC2) should be set to the input mode and the output pins (DVO, PPG) should be set to the output mode beforehand the output latch should be set to "1".
STOP OUTEN
P1CRi Data input
Data output
D
Q
P1i
Output latch
Control output Control input
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-3 Port P1
7 P1DR (0001H) P17
6 P16
5 P15 TC2
4 P14
PPG
3 P13
DVO
2 P12 INT2 TC1
1 P11 INT1
0 P10
INT0
(Initial value: 0000 0000)
P1CR (0009H)
7 P1CR7
6 P1CR6
5 P1CR5
4 P1CR4
3 P1CR3
2 P1CR2
1 P1CR1
0 P1CR0 (Initial value: 0000 0000)
P1CR
I/O control for port P1 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 57
5. I/O Ports
TMP86PS64FG
5.3 Port P2 (P22 to P20)
Port P2 is a 3-bit input/output port. During reset, the P2DR is initialized to "1". It is also used as INT5/STOP1. When used as secondary function pin or an input pin, the output latch should be set to "1". In the dual-clock mode, the low-frequency oscillator (32.768 kHz) is connected to P21 (XTIN) and P22 (XTOUT) pins. P2 port output latch (P2DR) and P2 port terminal input (P2R) are located on their respective address. When a read instruction is executed for port P2, read data of bits 7 to 3 are unstable.
Data input (P20IN) Data input (P20)
P20
Data output
D
Q
Output latch Control input
Data input (P21IN)
Osc.enable
Data input (P21)
P21
Data output
D
Q
Output latch Data input (P22IN) Data input (P22)
P22
Data output
D
Q
Output latch
STOP OUTEN
XTEN fs
Note: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1, XTEN: bit 6 in SYSCR2
Figure 5-4 Port P2
7 P2DR (0002H)
6
5
4
3
2 P22 XTOUT
1 P21 XTIN
0 P20
INT5 STOP1
(Initial value: **** *111)
P2R (002CH) Read only
7
6
5
4
3
2 P22IN
1 P21IN
0 P20IN (Initial value: **** ****)
Note 1: Port P20 is used as STOP1 pin. Therefore, when stop mode is started, however SYSCR1 is set to "1", port P20 becomes High-Z (input mode). Note 2: Each terminal has a protect diode. Please refer to section "Input/Output Circuitry; (2) Input/Output ports".
Page 58
TMP86PS64FG
5.4 Port P3 (P37 to P30)
Port P3 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P3 input/output control register (P3CR). During reset, the P3CR is initialized to "0", which configures port P3 as an input mode. The P3 output latches (P3DR) are also initialized to "1". Port P30, P31 and P32 are also used as TC4/PWM4/PDO4, TC5/PWM5/PDO5 and TC6/PWM6/PDO6. When used as secondary function pin, the input pins (TC4, TC5, TC6) should be set to the input mode and the output pins (PWM4/ PDO4, PWM5/PDO5, PWM6/PDO6) should be set to the output. Port P33, P34, P35, P36 and P37 are also used as SCK1, SI1, SO1, SI2 and SO2. When used as secondary function pin, SCK1 should be set to the input or output mode, SI1 and SI2 should be set to the input mode, SO1 and SO2 should be set to the output mode.
STOP OUTEN
P3CRi Data input
Data output
D
Q
P3i
Output latch Control output Control input
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-5 Port P3
7 P3DR (0003H) P37 SO2
6 P36 SI2
5 P35 SO1
4 P34 SI1
3 P33
SCK1
2 P32 TC6
PWM6 PDO6
1 P31 TC5
PWM5 PDO5
0 P30 TC4
PWM4 PDO4
(Initial value: 1111 1111)
P3CR (000BH)
7 P3CR7
6 P3CR6
5 P3CR5
4 P3CR4
3 P3CR3
2 P3CR2
1 P3CR1
0 P3CR0 (Initial value: 0000 0000)
P3CR
I/O control for port P3 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 59
5. I/O Ports
TMP86PS64FG
5.5 Port P4 (P47 to P40)
Port P4 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P4 input/output control register (P4CR). During reset, the P4CR is initialized to "0", which configures port P4 as an input mode. The P4 output latches are also initialized to "1". It is also used as INT0, INT1, INT2/TC1, TC2, DVO and PPG. When used as secondary function pin, the input pins (INT0, INT1, INT2, TC1, TC2) should be set to the input mode and the output pins (DVO, PPG) should be set to the output mode beforehand the output latch should be set to "1". Port P4 can be configured individually as a tri-state output or sink open drain output under software control. It is specified by the corresponding bit in the P4ODE. During reset, the P4ODE is initialized to "0", and then P4CR is set to "1", the tri-state output is configured. P4 port output latch (P4DR) and P4 port terminal input (P4R) are located on their respective address. When the input mode and output mode are configured simultaneously, even if the bit manipulate instruction is executed, the data of the output latch of the terminal set as the input mode is not influenced of the terminal input. Port P40, P41, P42, P44, P45, P46 and P47 are also used as SCK2, RXD1, TXD1, RXD2, TXD2, INT3/TC3 and INT4. When used as secondary function pin, the SCK1 pin should be set to the input or output mode, the input pins (RXD1, RXD2, INT3/TC3, INT4) should be set to the input mode and the output pins (TXD1, TXD2) should be set to the output.
P4ODEi STOP OUTEN
P4CRi Data input (P4R)
Data input (P4DR)
Data output
D
Q
P4i
Output latch Control output Control input
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-6 Port P4
Page 60
TMP86PS64FG
7 P4DR (0004H) P47 INT4
6 P46 INT3 TC3
5 P45 TXD2
4 P44 RXD2
3 P43
2 P42 TXD1
1 P41 RXD1
0 P40
SCK2
(Initial value: 1111 1111)
P4R (000AH) Read only
7 P47IN
6 P46IN
5 P45IN
4 P44IN
3 P43IN
2 P42IN
1 P41IN
0 P40IN (Initial value: **** ****)
P4CR (000CH)
7 P4CR7
6 P4CR6
5 P4CR5
4 P4CR4
3 P4CR3
2 P4CR2
1 P4CR1
0 P4CR0 (Initial value: 0000 0000)
P4CR
I/O control for port P4 (specified for each bit)
0: Input mode 1: Output mode
R/W
P4ODE (002DH)
7 P4ODE7
6 P4ODE6
5 P4ODE5
4 P4ODE4
3 P4ODE3
2 P4ODE2
1 P4ODE1
0 P4ODE0 (Initial value: 0000 0000)
P4ODE
P4 open drain control register (Specified for each bit)
0: Tri-state output 1: Sink open drain output
R/W
Note: Regardless of P4ODE setting, each terminal has a protect diode. Please refer to section "Input/Output Circuitry; (2) Input/ Output ports".
Page 61
5. I/O Ports
TMP86PS64FG
5.6 Port P5 (P57 to P50)
Port P5 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P5 input/output control register (P5CR). During reset, the P5CR is initialized to "0", which configures port P5 as an input mode. The P5 output latches are also initialized to "0".
STOP OUTEN
P5CRi Data input
Data output
D
Q
P5i
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-7 Port P5
P5DR (0005H)
7 P57
6 P56
5 P55
4 P54
3 P53
2 P52
1 P51
0 P50 (Initial value: 0000 0000)
P5CR (000DH)
7 P5CR7
6 P5CR6
5 P5CR5
4 P5CR4
3 P5CR3
2 P5CR2
1 P5CR1
0 P5CR0 (Initial value: 0000 0000)
P5CR
I/O control for port P5 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 62
TMP86PS64FG
5.7 Port P6 (P67to P60)
Port P6 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Port P6 is also used as an analog input. Input/output mode is specified by the corresponding bit in the port P6 input/output control register (P6CR), P6 output latch (P6DR) and ADCCR1. During reset, P6CR and P6DR are initialized to "0" and ADCCR1 is set to "1". At the same time, the input data of P67 to P60 are fixed to "0" level. When port P6 is used as input port, the corresponding bit in P6CR and P6DR should be set to input mode (P6CR = "0", P6DR = "1"). When used as output port, the corresponding bit in P6CR should be set to "1". When used as analog input port, the corresponding bit in P6CR and P6DR should be set to analog input mode (P6CR = "0", P6DR = "0") and ADCCR1 is set to "0", then the AD conversion is started. Setting P6DR to "0" is necessary to prevent generating the penetration electric current. So the output latch of the port used as analog input should be set to "0" beforehand. Actually selection of the conversion input channels is specified by ADCCR1. Pins used for analog input can be used as I/O port. During AD conversion, output instructions should not be executed to keep a precision. In addition, a variable signal should not be input to a port adjacent to the analog input during AD conversion. When the AD converter is in use (P6DR = "0"), bits mentioned above are read as "0" by executing input instructions.
VDD
P6PUi
Pull-up resistor (Typ. 80 k)
Analog input AINDS SAIN STOP OUTEN P6CRi Data input
Data output
D
Q
P6i
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1 Note 3: SAIN: AD input channel select signal
Figure 5-8 Port P6
Page 63
5. I/O Ports
TMP86PS64FG
P6DR (0006H)
7 P67 AIN7
6 P66 AIN6
5 P65 AIN5
4 P64 AIN4
3 P63 AIN3
2 P62 AIN2
1 P61 AIN1
0 P60 AIN0 (Initial value: 0000 0000)
P6CR (002EH)
7 P6CR7
6 P6CR6
5 P6CR5
4 P6CR4
3 P6CR3
2 P6CR2
1 P6CR1
0 P6CR0 (Initial value: 0000 0000)
AINDS = 1 (AD unused) P6CR I/O control for port P6 (specified for each bit) P6DR = "0" 0 1 Input "0" fixed #1 P6DR = "1" Input mode
AINDS = 0 (AD used) P6DR = "0" AD input #2 P6DR = "1" Input mode R/W
Output mode
#1 #2
Input data to a pin whose input is fixed to "0" is always "0" regardless of the pin state and whether or not a programmable pull-up resistor is added. When a read instruction for port P6 is executed, the bit of analog input mode becomes read data "0".
Note 1: Don't set output mode to pin, which is used for an analog input. Note 2: When used for input mode (include analog input mode), read-modify-write instruction such as bit manipulate instructions cannot be used. Read-modify-write instruction writes the all data of 8-bit after data is read and modified. Because a bit setting input mode read data of terminal, the output latch is changed by these instructions. So P6 port cannot input data.
P6PU (0FBCH)
7 P6PU7
6 P6PU6
5 P6PU5
4 P6PU4
3 P6PU3
2 P6PU2
1 P6PU1
0 P6PU0 (Initial value: 0000 0000)
P6PU
Port P6 pull up control register (specified for each bit)
0: Non pull-up 1: Pull-up
R/W
Note: However the P6PU is set to "1" (pull-up), the port configured output is not set up pull-up resistor.
Page 64
TMP86PS64FG
5.8 Port P7 (P77 to P70)
Port P7 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Port P7 is also used as an analog input and Key on Wake up input. Input/output mode is specified by the corresponding bit in the port P7 input/output control register (P7CR), P7 output latch (P7DR) and ADCCR1. During reset, P7CR and P7DR are initialized to "0" and ADCCR1 is set to "1". At the same time, the input data of P77 to P70 are fixed to "0" level. When port P7 is used as input port, the corresponding bit in P7CR and P7DR should be set to input mode (P7CR = "0", P7DR = "1"). When used as output port, the corresponding bit in P7CR should be set to "1". When used as analog input port, the corresponding bit in P7CR and P7DR should be set to analog input mode (P7CR = "0", P7DR = "0") and ADCCR1 is set to "0", then the AD conversion is started. Setting P7DR to "0" is necessary to prevent generating the penetration electric current. So the output latch of the port used as analog input should be set to "0" beforehand. Actually selection of the conversion input channels is specified by ADCCR1. Pins used for analog input can be used as I/O port. During AD conversion, output instructions should not be executed to keep a precision. In addition, a variable signal should not be input to a port adjacent to the analog input during AD conversion. When the AD converter is in use (P7DR = "0"), bits mentioned above are read as "0" by executing input instructions.
STOPjEN Key on Wake up P7PUi Analog input AINDS SAIN STOP OUTEN P7CRi Data input Pull-up resistor (Typ. 80 k) VDD
Data output
D
Q
P7i
Output latch
Note 1: i = 7 to 0, j = 5 to 2 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1 Note 3: SAIN: bit 0 to 3 in ADCCRA Note 4: SOTPjEN: bit 4 to 7 in STOPCR
Figure 5-9 Port P7
Page 65
5. I/O Ports
TMP86PS64FG
7 P7DR (0007H) P77 AIN15 STOP5
6 P76 AIN14 STOP4
5 P75 AIN13 STOP3
4 P74 AIN12 STOP2
3 P73 AIN11
2 P72 AIN10
1 P71 AIN9
0 P70 AIN8 (Initial value: 0000 0000)
P7CR (002FH)
7 P7CR7
6 P7CR6
5 P7CR5
4 P7CR4
3 P7CR3
2 P7CR2
1 P7CR1
0 P7CR0 (Initial value: 0000 0000)
AINDS = 1 (AD unused) P7CR I/O control for port P7 (specified for each bit) P7DR = "0" 0 1 Input "0" fixed #1 P7DR = "1" Input mode
AINDS = 0 (AD used) P7DR = "0" AD input #2 P7DR = "1" Input mode R/W
Output mode
#1 #2
Input data to a pin whose input is fixed to "0" is always "0" regardless of the pin state and whether or not a programmable pull-up resistor is added. When a read instruction for port P7 is executed, the bit of analog input mode becomes read data "0".
Note 1: Don't set output mode to pin, which is used for an analog input. Note 2: When used for input mode (include analog input mode), read-modify-write instruction such as bit manipulate instructions cannot be used. Read-modify-write instruction writes the all data of 8-bit after data is read and modified. Because a bit setting input mode read data of terminal, the output latch is changed by these instructions. So P7 port cannot input data.
P7PU (0FBDH)
7 P7PU7
6 P7PU6
5 P7PU5
4 P7PU4
3 P7PU3
2 P7PU2
1 P7PU1
0 P7PU0 (Initial value: 0000 0000)
P7PU
Port P7 pull up control register (specified for each bit)
0: Non pull-up 1: Pull-up
R/W
Note: However the P7PU is set to "1" (pull-up), the port configured output is not set up pull-up resistor.
Page 66
TMP86PS64FG
5.9 Port P8 (P87 to P80)
Port P8 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P8 input/output control register (P8CR). During reset, the P8CR is initialized to "0", which configures port P8 as an input. The P8 output latches are also initialized to "0".
STOP OUTEN
P8CRi Data input
Data output
D
Q
P8i
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-10 Port P8
P8DR (0FB0H)
7 P87
6 P86
5 P85
4 P84
3 P83
2 P82
1 P81
0 P80 (Initial value: 0000 0000)
P8CR (0FB2H)
7 P8CR7
6 P8CR6
5 P8CR5
4 P8CR4
3 P8CR3
2 P8CR2
1 P8CR1
0 P8CR0 (Initial value: 0000 0000)
P8CR
I/O control for port P8 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 67
5. I/O Ports
TMP86PS64FG
5.10 Port P9 (P97 to P90)
Port P9 is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port P9 input/output control register (P9CR). During reset, the P9CR is initialized to "0", which configures port P9 as an input. The P9 output latches are also initialized to "0".
STOP OUTEN
P9CRi Data input
Data output
D
Q
P9i
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-11 Port P9
P9DR (0FB1H)
7 P97
6 P96
5 P95
4 P94
3 P93
2 P92
1 P91
0 P90 (Initial value: 0000 0000)
P9CR (0FB3H)
7 P9CR7
6 P9CR6
5 P9CR5
4 P9CR4
3 P9CR3
2 P9CR2
1 P9CR1
0 P9CR0 (Initial value: 0000 0000)
P9CR
I/O control for port P9 (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
Page 68
TMP86PS64FG
5.11 Port PA (PA7 to PA0)
Port PA is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port PA input/output control register (PACR). During reset, the PACR is initialized to "0", which configures port PA as an input. The PA output latches are also initialized to "0".
VDD
PAPUi STOP OUTEN
Pull-up resistor (Typ. 80 k)
PACRi Data input
Data output
D
Q
PAi
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-12 Port PA
PADR (0FB6H)
7 PA7
6 PA6
5 PA5
4 PA4
3 PA3
2 PA2
1 PA1
0 PA0 (Initial value: 0000 0000)
PACR (0FB8H)
7 PACR7
6 PACR6
5 PACR5
4 PACR4
3 PACR3
2 PACR2
1 PACR1
0 PACR0 (Initial value: 0000 0000)
PACR
I/O control for port PA (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
PAPU (0FBAH)
7 PAPU7
6 PAPU6
5 PAPU5
4 PAPU4
3 PAPU3
2 PAPU2
1 PAPU1
0 PAPU0 (Initial value: 0000 0000)
PAPU
Port PA pull up control register (specified for each bit)
0: Non pull-up 1: Pull-up
R/W
Note: However the PAPU is set to "1" (pull-up), the port configured output is not set up pull-up resistor.
Page 69
5. I/O Ports
TMP86PS64FG
5.12 Port PB (PB7 to PB0)
Port PB is an 8-bit input/output port, which can be configured individually as an input or an output under software control. Input/output mode is specified by the corresponding bit in the port PB input/output control register (PBCR). During reset, the PBCR is initialized to "0" which configures port PB as an input. The PB output latches are also initialized to "0".
VDD
PBPUi
STOP OUTEN
Pull-up resistor (Typ. 80 k)
PBCRi Data input
Data output
D
Q
PBi
Output latch
Note 1: i = 7 to 0 Note 2: STOP: bit 7 in SYSCR1, OUTEN: bit 4 in SYSCR1
Figure 5-13 Port PB and PBCR
PBDR (0FB7H)
7 PB7
6 PB6
5 PB5
4 PB4
3 PB3
2 PB2
1 PB1
0 PB0 (Initial value: 0000 0000)
PBCR (0FB9H)
7 PBCR7
6 PBCR6
5 PBCR5
4 PBCR4
3 PBCR3
2 PBCR2
1 PBCR1
0 PBCR0 (Initial value: 0000 0000)
PBCR
I/O control for port PB (specified for each bit)
0: Input mode 1: Output mode
R/W
Note: When used as an input mode, read-modify-write instructions such as bit manipulate instructions cannot be used. Readmodify-write instruction writes the all data of 8-bit after read and modified. Because a bit setting input mode reads data of terminal, the output latch is changed by these instructions.
PBPU (0FBBH)
7 PBPU7
6 PBPU6
5 PBPU5
4 PBPU4
3 PBPU3
2 PBPU2
1 PBPU1
0 PBPU0 (Initial value: 0000 0000)
PBPU
Port PB pull up control register (specified for each bit)
0: Non pull-up 1: Pull-up
R/W
Note: However the PBPU is set to "1" (pull-up), the port configured output is not set up pull-up resistor.
Page 70
TMP86PS64FG
6. Watchdog Timer (WDT)
The watchdog timer is a fail-safe system to detect rapidly the CPU malfunctions such as endless loops due to spurious noises or the deadlock conditions, and return the CPU to a system recovery routine. The watchdog timer signal for detecting malfunctions can be programmed only once as "reset request" or "interrupt request". Upon the reset release, this signal is initialized to "reset request". When the watchdog timer is not used to detect malfunctions, it can be used as the timer to provide a periodic interrupt.
Note: Care must be taken in system design since the watchdog timer functions are not be operated completely due to effect of disturbing noise.
6.1 Watchdog Timer Configuration
Reset release
fc/2 ,fc/2 or fs/2 fc/221,fc/222 or fs/213 fc/219,fc/220 or fs/211 fc/217,fc/218 or fs/29
23 24 15
Selector
Binary counters Clock Clear 1 2 Overflow WDT output
R S Q Reset request INTWDT interrupt request
2
Interrupt request
Internal reset Q SR
WDTEN WDTT
Writing disable code
Writing clear code
WDTOUT
Controller
0034H WDTCR1
0035H WDTCR2
Watchdog timer control registers
Figure 6-1 Watchdog Timer Configuration
Page 71
6. Watchdog Timer (WDT)
6.2 Watchdog Timer Control TMP86PS64FG
6.2 Watchdog Timer Control
The watchdog timer is controlled by the watchdog timer control registers (WDTCR1 and WDTCR2). The watchdog timer is automatically enabled after the reset release.
6.2.1
Malfunction Detection Methods Using the Watchdog Timer
The CPU malfunction is detected, as shown below. 1. Set the detection time, select the output, and clear the binary counter. 2. Clear the binary counter repeatedly within the specified detection time. If the CPU malfunctions such as endless loops or the deadlock conditions occur for some reason, the watchdog timer output is activated by the binary-counter overflow unless the binary counters are cleared. When WDTCR1 is set to "1" at this time, the reset request is generated and then internal hardware is initialized. When WDTCR1 is set to "0", a watchdog timer interrupt (INTWDT) is generated. The watchdog timer temporarily stops counting in the STOP mode including the warm-up or IDLE/SLEEP mode, and automatically restarts (continues counting) when the STOP/IDLE/SLEEP mode is inactivated.
Note:The watchdog timer consists of an internal divider and a two-stage binary counter. When the clear code 4EH is written, only the binary counter is cleared, but not the internal divider. The minimum binary-counter overflow time, that depends on the timing at which the clear code (4EH) is written to the WDTCR2 register, may be 3/ 4 of the time set in WDTCR1. Therefore, write the clear code using a cycle shorter than 3/4 of the time set to WDTCR1.
Example :Setting the watchdog timer detection time to 221/fc [s], and resetting the CPU malfunction detection
LD LD LD (WDTCR2), 4EH (WDTCR1), 00001101B (WDTCR2), 4EH : Clears the binary counters. : WDTT 10, WDTOUT 1 : Clears the binary counters (always clears immediately before and after changing WDTT).
Within 3/4 of WDT detection time
: :
LD
(WDTCR2), 4EH
: Clears the binary counters.
Within 3/4 of WDT detection time
: : LD (WDTCR2), 4EH : Clears the binary counters.
Page 72
TMP86PS64FG
Watchdog Timer Control Register 1
WDTCR1 (0034H) 7 6 5 (ATAS) 4 (ATOUT) 3 WDTEN 2 WDTT 1 0 WDTOUT (Initial value: **11 1001)
WDTEN
Watchdog timer enable/disable
0: Disable (Writing the disable code to WDTCR2 is required.) 1: Enable NORMAL1/2 mode DV7CK = 0 DV1CK=0 DV1CK=1 226/fc 224/fc 222fc 220/fc DV7CK = 1 DV1CK=0 217/fs 215/fs 213/fs 211/fs DV1CK=1 217/fs 215/fs 213/fs 211/fs 217/fs 215fs 213fs 211/fs SLOW1/2 mode
Write only
WDTT
Watchdog timer detection time [s]
00 01 10 11
225/fc 223/fc 221fc 219/fc
Write only
WDTOUT
Watchdog timer output select
0: Interrupt request 1: Reset request
Write only
Note 1: After clearing WDTOUT to "0", the program cannot set it to "1". Note 2: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 3: WDTCR1 is a write-only register and must not be used with any of read-modify-write instructions. If WDTCR1 is read, a don't care is read. Note 4: To activate the STOP mode, disable the watchdog timer or clear the counter immediately before entering the STOP mode. After clearing the counter, clear the counter again immediately after the STOP mode is inactivated. Note 5: To clear WDTEN, set the register in accordance with the procedures shown in "1.2.3 Watchdog Timer Disable".
Watchdog Timer Control Register 2
WDTCR2 (0035H) 7 6 5 4 3 2 1 0 (Initial value: **** ****)
WDTCR2
Write Watchdog timer control code
4EH: Clear the watchdog timer binary counter (Clear code) B1H: Disable the watchdog timer (Disable code) D2H: Enable assigning address trap area Others: Invalid
Write only
Note 1: The disable code is valid only when WDTCR1 = 0. Note 2: *: Don't care Note 3: The binary counter of the watchdog timer must not be cleared by the interrupt task. Note 4: Write the clear code 4EH using a cycle shorter than 3/4 of the time set in WDTCR1.
6.2.2
Watchdog Timer Enable
Setting WDTCR1 to "1" enables the watchdog timer. Since WDTCR1 is initialized to "1" during reset, the watchdog timer is enabled automatically after the reset release.
Page 73
6. Watchdog Timer (WDT)
6.2 Watchdog Timer Control TMP86PS64FG
6.2.3
Watchdog Timer Disable
To disable the watchdog timer, set the register in accordance with the following procedures. Setting the register in other procedures causes a malfunction of the microcontroller. 1. Set the interrupt master flag (IMF) to "0". 2. Set WDTCR2 to the clear code (4EH). 3. Set WDTCR1 to "0". 4. Set WDTCR2 to the disable code (B1H).
Note:While the watchdog timer is disabled, the binary counters of the watchdog timer are cleared.
Example :Disabling the watchdog timer
DI LD LDW (WDTCR2), 04EH (WDTCR1), 0B101H : IMF 0 : Clears the binary coutner : WDTEN 0, WDTCR2 Disable code
Table 6-1 Watchdog Timer Detection Time (Example: fc = 16.0 MHz, fs = 32.768 kHz) Watchdog Timer Detection Time[s]
WDTT DV7CK = 0 DV1CK = 0 00 01 10 11 2.097 524.288 m 131.072 m 32.768 m DV1CK = 1 4.194 1.049 262.144 m 65.536 m NORMAL1/2 mode DV7CK = 1 DV1CK = 0 4 1 250 m 62.5 m DV1CK = 1 4 1 250 m 62.5 m 4 1 250 m 62.5 m SLOW mode
6.2.4
Watchdog Timer Interrupt (INTWDT)
When WDTCR1 is cleared to "0", a watchdog timer interrupt request (INTWDT) is generated by the binary-counter overflow. A watchdog timer interrupt is the non-maskable interrupt which can be accepted regardless of the interrupt master flag (IMF). When a watchdog timer interrupt is generated while the other interrupt including a watchdog timer interrupt is already accepted, the new watchdog timer interrupt is processed immediately and the previous interrupt is held pending. Therefore, if watchdog timer interrupts are generated continuously without execution of the RETN instruction, too many levels of nesting may cause a malfunction of the microcontroller. To generate a watchdog timer interrupt, set the stack pointer before setting WDTCR1.
Example :Setting watchdog timer interrupt
LD LD SP, 083FH (WDTCR1), 00001000B : Sets the stack pointer : WDTOUT 0
Page 74
TMP86PS64FG
6.2.5
Watchdog Timer Reset
When a binary-counter overflow occurs while WDTCR1 is set to "1", a watchdog timer reset request is generated. When a watchdog timer reset request is generated, the internal hardware is reset. The reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 MHz).
Note:When a watchdog timer reset is generated in the SLOW1 mode, the reset time is maximum 24/fc (high-frequency clock) since the high-frequency clock oscillator is restarted. However, when crystals have inaccuracies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors.
219/fc [s]
217/fc
Clock Binary counter Overflow INTWDT interrupt request
(WDTCR1= "0")
(WDTT=11)
1 2 3 0 1 2 3 0
Internal reset
(WDTCR1= "1")
A reset occurs
Write 4EH to WDTCR2
Figure 6-2 Watchdog Timer Interrupt
Page 75
6. Watchdog Timer (WDT)
6.3 Address Trap TMP86PS64FG
6.3 Address Trap
The Watchdog Timer Control Register 1 and 2 share the addresses with the control registers to generate address traps. Watchdog Timer Control Register 1
WDTCR1 (0034H) 7 6 5 ATAS 4 ATOUT 3 (WDTEN) 2 (WDTT) 1 0 (WDTOUT) (Initial value: **11 1001)
ATAS
Select address trap generation in the internal RAM area Select opertion at address trap
0: Generate no address trap 1: Generate address traps (After setting ATAS to "1", writing the control code D2H to WDTCR2 is reguired) 0: Interrupt request 1: Reset request
Write only
ATOUT
Watchdog Timer Control Register 2
WDTCR2 (0035H) 7 6 5 4 3 2 1 0 (Initial value: **** ****)
WDTCR2
Write Watchdog timer control code and address trap area control code
D2H: Enable address trap area selection (ATRAP control code) 4EH: Clear the watchdog timer binary counter (WDT clear code) B1H: Disable the watchdog timer (WDT disable code) Others: Invalid
Write only
6.3.1
Selection of Address Trap in Internal RAM (ATAS)
WDTCR1 specifies whether or not to generate address traps in the internal RAM area. To execute an instruction in the internal RAM area, clear WDTCR1 to "0". To enable the WDTCR1 setting, set WDTCR1 and then write D2H to WDTCR2. Executing an instruction in the SFR or DBR area generates an address trap unconditionally regardless of the setting in WDTCR1.
6.3.2
Selection of Operation at Address Trap (ATOUT)
When an address trap is generated, either the interrupt request or the reset request can be selected by WDTCR1.
6.3.3
Address Trap Interrupt (INTATRAP)
While WDTCR1 is "0", if the CPU should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip RAM (while WDTCR1 is "1"), DBR or the SFR area, address trap interrupt (INTATRAP) will be generated. An address trap interrupt is a non-maskable interrupt which can be accepted regardless of the interrupt master flag (IMF). When an address trap interrupt is generated while the other interrupt including a watchdog timer interrupt is already accepted, the new address trap is processed immediately and the previous interrupt is held pending. Therefore, if address trap interrupts are generated continuously without execution of the RETN instruction, too many levels of nesting may cause a malfunction of the microcontroller. To generate address trap interrupts, set the stack pointer beforehand.
Page 76
TMP86PS64FG
6.3.4
Address Trap Reset
While WDTCR1 is "1", if the CPU should start looping for some cause such as noise and an attempt be made to fetch an instruction from the on-chip RAM (while WDTCR1 is "1"), DBR or the SFR area, address trap reset will be generated. When an address trap reset request is generated, the internal hardware is reset. The reset time is maximum 24/fc [s] (1.5 s @ fc = 16.0 MHz).
Note:When an address trap reset is generated in the SLOW1 mode, the reset time is maximum 24/fc (high-frequency clock) since the high-frequency clock oscillator is restarted. However, when crystals have inaccuracies upon start of the high-frequency clock oscillator, the reset time should be considered as an approximate value because it has slight errors.
Page 77
6. Watchdog Timer (WDT)
6.3 Address Trap TMP86PS64FG
Page 78
TMP86PS64FG
7. Time Base Timer (TBT)
The time base timer generates time base for key scanning, dynamic displaying, etc. It also provides a time base timer interrupt (INTTBT).
7.1 Time Base Timer
7.1.1 Configuration
MPX
fc/223,fc/224 or fs/215 fc/221,fc/222 or fs/213 fc/216,fc/217 or fs/28 fc/214,fc/215 or fs/26 fc/213,fc/214 or fs/25 fc/212,fc/213 or fs/24 fc/211,fc/212 or fs/23 fc/29,fc/210 or fs/2
Source clock
Falling edge detector
IDLE0, SLEEP0 release request
INTTBT interrupt request
3 TBTCK TBTCR Time base timer control register TBTEN
Figure 7-1 Time Base Timer configuration 7.1.2 Control
Time Base Timer is controled by Time Base Timer control register (TBTCR). Time Base Timer Control Register
7 TBTCR (0036H) (DVOEN) 6 (DVOCK) 5 4 (DV7CK) 3 TBTEN 2 1 TBTCK 0 (Initial Value: 0000 0000)
TBTEN
Time Base Timer Enable / Disable
0: Disable 1: Enable NORMAL1/2, IDLE1/2 Mode DV7CK = 0 DV1CK=0 000 001 fc/223 fc/221 fc/216 fc/214 fc/213 fc/212 fc/2
11 9
DV7CK = 1 DV1CK=0 fs/215 fs/213 fs/28 fs/26 fs/25 fs/24 fs/2
3
DV1CK=1 fc/224 fc/222 fc/217 fc/215 fc/214 fc/213 fc/2 fc/2
12 10
DV1CK=1 fs/215 fs/213 fs/28 fs/26 fs/25 fs/24 fs/2
3
SLOW1/2 SLEEP1/2 Mode fs/215 fs/213 - - - - - - R/W
TBTCK
Time Base Timer interrupt Frequency select : [Hz]
010 011 100 101 110 111
fc/2
fs/2
fs/2
Note 1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz], *; Don't care
Page 79
7. Time Base Timer (TBT)
7.1 Time Base Timer TMP86PS64FG
Note 2: The interrupt frequency (TBTCK) must be selected with the time base timer disabled (TBTEN="0"). (The interrupt frequency must not be changed with the disable from the enable state.) Both frequency selection and enabling can be performed simultaneously.
Example :Set the time base timer frequency to fc/216 [Hz] and enable an INTTBT interrupt.
LD LD DI SET (EIRH) . 0 (TBTCR) , 00000010B (TBTCR) , 00001010B ; TBTCK 010 ; TBTEN 1 ; IMF 0
Table 7-1 Time Base Timer Interrupt Frequency ( Example : fc = 16.0 MHz, fs = 32.768 kHz )
Time Base Timer Interrupt Frequency [Hz] TBTCK NORMAL1/2, IDLE1/2 Mode DV7CK = 0 DV1CK = 0 000 001 010 011 100 101 110 111 1.91 7.63 244.14 976.56 1953.13 3906.25 7812.5 31250 DV1CK = 1 0.95 3.81 122.07 488.28 976.56 1953.13 3906.25 15625 NORMAL1/2, IDLE1/2 Mode DV7CK = 1 DV1CK = 0 1 4 128 512 1024 2048 4096 16384 DV1CK = 1 1 4 128 512 1024 2048 4096 16384 1 4 - - - - - - SLOW1/2, SLEEP1/2 Mode
7.1.3
Function
An INTTBT ( Time Base Timer Interrupt ) is generated on the first falling edge of source clock ( The divider output of the timing generato which is selected by TBTCK. ) after time base timer has been enabled. The divider is not cleared by the program; therefore, only the first interrupt may be generated ahead of the set interrupt period ( Figure 7-2 ).
Source clock
TBTCR
INTTBT Interrupt period Enable TBT
Figure 7-2 Time Base Timer Interrupt
Page 80
TMP86PS64FG
7.2 Divider Output (DVO)
Approximately 50% duty pulse can be output using the divider output circuit, which is useful for piezoelectric buzzer drive. Divider output is from DVO pin.
7.2.1
Configuration
Output latch Data output D Q DVO pin
fc/213,fc/214 or fs/25 fc/212,fc/213 or fs/24 fc/211,fc/212 or fs/23 fc/210,fc/211 or fs/22
MPX A B CY D S 2 DVOCK TBTCR Divider output control register (a) configuration DVOEN
Port output latch TBTCR
DVO pin output (b) Timing chart
Figure 7-3 Divider Output 7.2.2 Control
The Divider Output is controlled by the Time Base Timer Control Register. Time Base Timer Control Register
7 TBTCR (0036H) DVOEN 6 DVOCK 5 4 (DV7CK) 3 (TBTEN) 2 1 (TBTCK) 0 (Initial value: 0000 0000)
DVOEN
Divider output enable / disable
0: Disable 1: Enable NORMAL1/2, IDLE1/2 Mode DV7CK=0 DV7CK=1 SLOW1/2 SLEEP1/2 Mode fs/25 fs/24 fs/23 fs/22
R/W
DV1CK = 0 DV1CK = 1 DV1CK = 0 DV1CK = 1 DVOCK Divider Output (DVO) frequency selection: [Hz] 00 01 10 11 fc/213 fc/212 fc/211 fc/210 fc/214 fc/213 fc/212 fc/211 fs/25 fs/24 fs/23 fs/22 fs/25 fs/24 fs/23 fs/22
R/W
Note: Selection of divider output frequency (DVOCK) must be made while divider output is disabled (DVOEN="0"). Also, in other words, when changing the state of the divider output frequency from enabled (DVOEN="1") to disable(DVOEN="0"), do not change the setting of the divider output frequency.
Page 81
7. Time Base Timer (TBT)
7.2 Divider Output (DVO) TMP86PS64FG
Example :1.95 kHz pulse output (fc = 16.0 MHz)
LD LD
(TBTCR) , 00000000B (TBTCR) , 10000000B
; DVOCK "00" ; DVOEN "1"
Table 7-2 Divider Output Frequency ( Example : fc = 16.0 MHz, fs = 32.768 kHz )
Divider Output Frequency [Hz] DVOCK NORMAL1/2, IDLE1/2 Mode DV7CK = 0 DV1CK=0 00 01 10 11 1.953 k 3.906 k 7.813 k 15.625 k DV1CK=1 976.6 1.953 k 3.906 k 7.813 k DV7CK = 1 DV1CK=0 1.024 k 2.048 k 4.096 k 8.192 k DV1CK=1 1.024 k 2.048 k 4.096 k 8.192 k 1.024 k 2.048 k 4.096 k 8.192 k SLOW1/2, SLEEP1/2 Mode
Page 82
MCAP1
S
A
TC1S
Y
INTTC1 interript
8.1 Configuration
B
2
Decoder
Command start
Start
MPPG1 TC1S clear
Pulse width measurement mode
External trigger
External trigger start
PPG output mode
Set Q
Rising
Falling
Clear
Edge detector
METT1
TC1
Clear
Y
8. 16-Bit TimerCounter 1 (TC1)
Port (Note)
D
Figure 8-1 TimerCounter 1 (TC1)
16-bit up-counter
S
Page 83
Source clock
Match
CMP Pulse width measurement mode
fc/211, fc/212, fs/23
A
B
fc/27,
fc/26
B
Y
A
fc/23, fc/24
C
S
Toggle Q
2
Window mode
Clear
Selector
S Q Set
Set Clear
Port (Note)
PPG output mode Internal reset
Toggle
Enable
pin
Capture
TC1DRB
TC1DRA
16-bit timer register A, B
ACAP1
TC1CK
TC1CR
Write to TC1CR
TFF1
TC1 control register
TMP86PS64FG
Note: Function I/O may not operate depending on I/O port setting. For more details, see the chapter "I/O Port".
8. 16-Bit TimerCounter 1 (TC1)
8.2 TimerCounter Control TMP86PS64FG
8.2 TimerCounter Control
The TimerCounter 1 is controlled by the TimerCounter 1 control register (TC1CR) and two 16-bit timer registers (TC1DRA and TC1DRB). Timer Register
15 TC1DRA (0021H, 0020H) TC1DRB (0023H, 0022H) 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 TC1DRAH (0021H) (Initial value: 1111 1111 1111 1111) TC1DRBH (0023H) (Initial value: 1111 1111 1111 1111) TC1DRAL (0020H) Read/Write TC1DRBL (0022H) Read/Write (Write enabled only in the PPG output mode)
TimerCounter 1 Control Register
7 TC1CR (0032H) 6 ACAP1 MCAP1 METT1 MPPG1 5 4 3 2 1 0 Read/Write (Initial value: 0000 0000)
TFF1
TC1S
TC1CK
TC1M
TFF1 ACAP1 MCAP1 METT1 MPPG1
Timer F/F1 control Auto capture control Pulse width measurement mode control External trigger timer mode control PPG output control
0: Clear 0:Auto-capture disable 0:Double edge capture 0:Trigger start 0:Continuous pulse generation Timer 00: Stop and counter clear 01: Command start 10: Rising edge start (Ex-trigger/Pulse/PPG) Rising edge count (Event) Positive logic count (Window) 11: Falling edge start (Ex-trigger/Pulse/PPG) Falling edge count (Event) Negative logic count (Window) O O
1: Set 1:Auto-capture enable 1:Single edge capture
R/W
R/W 1:Trigger start and stop 1:One-shot Extrigger O - Event O - Window O - Pulse O - PPG O O
TC1S
TC1 start control
-
O
O
O
O
O
R/W
-
O
O
O
O
O
NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 TC1CK TC1 source clock select [Hz] 00 01 10 11 TC1 operating mode select fc/2
11
DV7CK = 1 DV1CK = 0 fs/2
3
Divider
DV1CK = 1 fc/2
12
DV1CK = 1 fs/23 fc/28 fc/2
4
SLOW, SLEEP mode fs/23 - - R/W
DV9 DV5 DV1
fc/27 fc/2
3
fc/28 fc/2
4
fc/27 fc/2
3
External clock (TC1 pin input)
TC1M
00: Timer/external trigger timer/event counter mode 01: Window mode 10: Pulse width measurement mode 11: PPG (Programmable pulse generate) output mode
R/W
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz] Note 2: The timer register consists of two shift registers. A value set in the timer register becomes valid at the rising edge of the first source clock pulse that occurs after the upper byte (TC1DRAH and TC1DRBH) is written. Therefore, write the lower byte and the upper byte in this order (it is recommended to write the register with a 16-bit access instruction). Writing only the lower byte (TC1DRAL and TC1DRBL) does not enable the setting of the timer register.
Page 84
TMP86PS64FG
Note 3: To set the mode, source clock, PPG output control and timer F/F control, write to TC1CR1 during TC1S=00. Set the timer F/F1 control until the first timer start after setting the PPG mode. Note 4: Auto-capture can be used only in the timer, event counter, and window modes. Note 5: To set the timer registers, the following relationship must be satisfied. TC1DRA > TC1DRB > 1 (PPG output mode), TC1DRA > 1 (other modes) Note 6: Set TFF1 to "0" in the mode except PPG output mode. Note 7: Set TC1DRB after setting TC1M to the PPG output mode. Note 8: When the STOP mode is entered, the start control (TC1S) is cleared to "00" automatically, and the timer stops. After the STOP mode is exited, set the TC1S to use the timer counter again. Note 9: Use the auto-capture function in the operative condition of TC1. A captured value may not be fixed if it's read after the execution of the timer stop or auto-capture disable. Read the capture value in a capture enabled condition. Note 10:Since the up-counter value is captured into TC1DRB by the source clock of up-counter after setting TC1CR to "1". Therefore, to read the captured value, wait at least one cycle of the internal source clock before reading TC1DRB for the first time.
Page 85
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
8.3 Function
TimerCounter 1 has six types of operating modes: timer, external trigger timer, event counter, window, pulse width measurement, programmable pulse generator output modes.
8.3.1
Timer mode
In the timer mode, the up-counter counts up using the internal clock. When a match between the up-counter and the timer register 1A (TC1DRA) value is detected, an INTTC1 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting. Setting TC1CR to "1" captures the up-counter value into the timer register 1B (TC1DRB) with the auto-capture function. Use the auto-capture function in the operative condition of TC1. A captured value may not be fixed if it's read after the execution of the timer stop or auto-capture disable. Read the capture value in a capture enabled condition. Since the up-counter value is captured into TC1DRB by the source clock of up-counter after setting TC1CR to "1". Therefore, to read the captured value, wait at least one cycle of the internal source clock before reading TC1DRB for the first time. Table 8-1 Internal Source Clock for TimerCounter 1 (Example: fc = 16 MHz, fs = 32.768 kHz)
NORMAL1/2, IDLE1/2 mode TC1CK DV7CK = 0 DV1CK = 0 Resolution [s] 00 01 10 128 8.0 0.5 Maximum Time Setting [s] 8.39 0.524 32.77 m DV1CK = 1 Resolution [s] 256 16 1 Maximum Time Setting [s] 16.78 1.05 65.53 m DV1CK = 0 Resolution [s] 244.14 8.0 0.5 Maximum Time Setting [s] 16.0 0.524 32.77 m DV7CK = 1 DV1CK = 1 Resolution [s] 244.14 16.0 1.0 Maximum Time Setting [s] 16.0 0.838 52.42 m Resolution [s] 244.14 - - Maximum Time Setting [s] 16.0 - - SLOW, SLEEP mode
Example 1 :Setting the timer mode with source clock fc/211 [Hz] and generating an interrupt 1 second later (fc = 16 MHz, TBTCR = "0", CGCR = "0")
LDW DI SET EI LD LD (TC1CR), 00000000B (TC1CR), 00010000B (EIRH). 1 (TC1DRA), 1E84H ; Sets the timer register (1 s / 211/fc = 1E84H) ; IMF= "0" ; Enables INTTC1 ; IMF= "1" ; Selects the source clock and mode ; Starts TC1
Example 2 :Auto-capture
LD : LD (TC1CR), 01010000B : WA, (TC1DRB) ; Reads the capture value ; ACAP1 1
Note: Since the up-counter value is captured into TC1DRB by the source clock of up-counter after setting TC1CR to "1". Therefore, to read the captured value, wait at least one cycle of the internal source clock before reading TC1DRB for the first time.
Page 86
TMP86PS64FG
Timer start Source clock Counter TC1DRA
0
1
2
3
4
n-1
n
0
1
2
3
4
5
6
7
?
n
INTTC1 interruput request
Match detect (a) Timer mode
Counter clear
Source clock
Counter
m-2
m-1
m
m+1
m+2
n-1
n
n+1
Capture
Capture
m+1 m+2
n-1
TC1DRB
?
m-1
m
n
n+1
ACAP1 (b) Auto-capture
Figure 8-2 Timer Mode Timing Chart
Page 87
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
8.3.2
External Trigger Timer Mode
In the external trigger timer mode, the up-counter starts counting by the input pulse triggering of the TC1 pin, and counts up at the edge of the internal clock. For the trigger edge used to start counting, either the rising or falling edge is defined in TC1CR. * When TC1CR is set to "1" (trigger start and stop) When a match between the up-counter and the TC1DRA value is detected after the timer starts, the up-counter is cleared and halted and an INTTC1 interrupt request is generated. If the edge opposite to trigger edge is detected before detecting a match between the up-counter and the TC1DRA, the up-counter is cleared and halted without generating an interrupt request. Therefore, this mode can be used to detect exceeding the specified pulse by interrupt. After being halted, the up-counter restarts counting when the trigger edge is detected. * When TC1CR is set to "0" (trigger start) When a match between the up-counter and the TC1DRA value is detected after the timer starts, the up-counter is cleared and halted and an INTTC1 interrupt request is generated. The edge opposite to the trigger edge has no effect in count up. The trigger edge for the next counting is ignored if detecting it before detecting a match between the up-counter and the TC1DRA.
Since the TC1 pin input has the noise rejection, pulses of 4/fc [s] or less are rejected as noise. A pulse width of 12/fc [s] or more is required to ensure edge detection. The rejection circuit is turned off in the SLOW1/2 or SLEEP1/2 mode, but a pulse width of one machine cycle or more is required. Example 1 :Generating an interrupt 1 ms after the rising edge of the input pulse to the TC1 pin (fc =16 MHz, CGCR = "0")
LDW DI SET EI LD LD (TC1CR), 00000100B (TC1CR), 00100100B (EIRH). 1 (TC1DRA), 007DH ; 1ms / 27/fc = 7DH ; IMF= "0" ; Enables INTTC1 interrupt ; IMF= "1" ; Selects the source clock and mode ; Starts TC1 external trigger, METT1 = 0
Example 2 :Generating an interrupt when the low-level pulse with 4 ms or more width is input to the TC1 pin (fc =16 MHz, CGCR = "0")
LDW DI SET EI LD LD (TC1CR), 00000100B (TC1CR), 01110100B (EIRH). 1 (TC1DRA), 01F4H ; 4 ms / 27/fc = 1F4H ; IMF= "0" ; Enables INTTC1 interrupt ; IMF= "1" ; Selects the source clock and mode ; Starts TC1 external trigger, METT1 = 0
Page 88
TMP86PS64FG
Count start TC1 pin input
Count start
At the rising edge (TC1S = 10)
Source clock
Up-counter
0
1
2
3
4
n-1 n
0
1
2
3
TC1DRA
n
Match detect
Count clear
INTTC1 interrupt request
(a) Trigger start (METT1 = 0)
At the rising edge (TC1S = 10)
Count start
Count clear
Count start
TC1 pin input
Source clock
Up-counter
0
1
2
3
m-1 m
0
1
2
3
n
0
TC1DRA
n
Match detect
Count clear
INTTC1 interrupt request
Note: m < n
(b) Trigger start and stop (METT1 = 1)
Figure 8-3 External Trigger Timer Mode Timing Chart
Page 89
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
8.3.3
Event Counter Mode
In the event counter mode, the up-counter counts up at the edge of the input pulse to the TC1 pin. Either the rising or falling edge of the input pulse is selected as the count up edge in TC1CR. When a match between the up-counter and the TC1DRA value is detected, an INTTC1 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting at each edge of the input pulse to the TC1 pin. Since a match between the up-counter and the value set to TC1DRA is detected at the edge opposite to the selected edge, an INTTC1 interrupt request is generated after a match of the value at the edge opposite to the selected edge. Two or more machine cycles are required for the low-or high-level pulse input to the TC1 pin. Setting TC1CR to "1" captures the up-counter value into TC1DRB with the auto capture function. Use the auto-capture function in the operative condition of TC1. A captured value may not be fixed if it's read after the execution of the timer stop or auto-capture disable. Read the capture value in a capture enabled condition. Since the up-counter value is captured into TC1DRB by the source clock of up-counter after setting TC1CR to "1". Therefore, to read the captured value, wait at least one cycle of the internal source clock before reading TC1DRB for the first time.
Timer start
TC1 pin Input Up-counter TC1DRA INTTC1 interrput request ?
0
1 2
n-1
n
0
1
2
At the rising edge (TC1S = 10)
n
Match detect
Counter clear
Figure 8-4 Event Counter Mode Timing Chart
Table 8-2 Input Pulse Width to TC1 Pin
Minimum Pulse Width [s] NORMAL1/2, IDLE1/2 Mode High-going Low-going 23/fc 23/fc SLOW1/2, SLEEP1/2 Mode 23/fs 23/fs
Page 90
TMP86PS64FG
8.3.4
Window Mode
In the window mode, the up-counter counts up at the rising edge of the pulse that is logical ANDed product of the input pulse to the TC1 pin (window pulse) and the internal source clock. Either the positive logic (count up during high-going pulse) or negative logic (count up during low-going pulse) can be selected. When a match between the up-counter and the TC1DRA value is detected, an INTTC1 interrupt is generated and the up-counter is cleared. Define the window pulse to the frequency which is sufficiently lower than the internal source clock programmed with TC1CR.
Count start Timer start Count stop Count start
TC1 pin input Internal clock Counter TC1DRA INTTC1 interrput request ? 7 Match detect (a) Positive logic (TC1S = 10)
Timer start Count start Count stop Count start
0
1
2
3
4
5
6
7
0
1
2
3
Counter clear
TC1 pin input Internal clock Counter TC1DRA INTTC1 interrput request (b) Negative logic (TC1S = 11) ? 9 Match detect Counter clear 0 1 2 3 4 5 6 7 8 90 1
Figure 8-5 Window Mode Timing Chart
Page 91
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
8.3.5
Pulse Width Measurement Mode
In the pulse width measurement mode, the up-counter starts counting by the input pulse triggering of the TC1 pin, and counts up at the edge of the internal clock. Either the rising or falling edge of the internal clock is selected as the trigger edge in TC1CR. Either the single- or double-edge capture is selected as the trigger edge in TC1CR. * When TC1CR is set to "1" (single-edge capture) Either high- or low-level input pulse width can be measured. To measure the high-level input pulse width, set the rising edge to TC1CR. To measure the low-level input pulse width, set the falling edge to TC1CR. When detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into TC1DRB and generates an INTTC1 interrupt request. The up-counter is cleared at this time, and then restarts counting when detecting the trigger edge used to start counting. * When TC1CR is set to "0" (double-edge capture) The cycle starting with either the high- or low-going input pulse can be measured. To measure the cycle starting with the high-going pulse, set the rising edge to TC1CR. To measure the cycle starting with the low-going pulse, set the falling edge to TC1CR. When detecting the edge opposite to the trigger edge used to start counting after the timer starts, the up-counter captures the up-counter value into TC1DRB and generates an INTTC1 interrupt request. The up-counter continues counting up, and captures the up-counter value into TC1DRB and generates an INTTC1 interrupt request when detecting the trigger edge used to start counting. The up-counter is cleared at this time, and then continues counting.
Note 1: The captured value must be read from TC1DRB until the next trigger edge is detected. If not read, the captured value becomes a don't care. It is recommended to use a 16-bit access instruction to read the captured value from TC1DRB. Note 2: For the single-edge capture, the counter after capturing the value stops at "1" until detecting the next edge. Therefore, the second captured value is "1" larger than the captured value immediately after counting starts. Note 3: The first captured value after the timer starts may be read incorrectively, therefore, ignore the first captured value.
Page 92
TMP86PS64FG
Example :Duty measurement (resolution fc/27 [Hz], CGCR = "0")
CLR LD DI SET EI LD : PINTTC1: CPL JRS LD LD LD RETI SINTTC1: LD LD LD : RETI : VINTTC1: DW PINTTC1 ; INTTC1 Interrupt vector ; Duty calculation A, (TC1DRBL) W,(TC1DRBH) (WIDTH), WA ; Stores cycle in RAM ; Reads TC1DRB (Cycle) (INTTC1SW). 0 F, SINTTC1 A, (TC1DRBL) W,(TC1DRBH) (HPULSE), WA ; Stores high-level pulse width in RAM ; Reads TC1DRB (High-level pulse width) ; INTTC1 interrupt, inverts and tests INTTC1 service switch (TC1CR), 00100110B (EIRH). 1 (INTTC1SW). 0 (TC1CR), 00000110B ; INTTC1 service switch initial setting Address set to convert INTTC1SW at each INTTC1 ; Sets the TC1 mode and source clock ; IMF= "0" ; Enables INTTC1 ; IMF= "1" ; Starts TC1 with an external trigger at MCAP1 = 0
WIDTH HPULSE TC1 pin INTTC1 interrupt request INTTC1SW
Page 93
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
Count start TC1 pin input Trigger
Count start (TC1S = "10")
Internal clock Counter TC1DRB INTTC1 interrupt request
0
1 2 3 4
n-1 n 0
1 Capture n
2
3
[Application] High-or low-level pulse width measurement (a) Single-edge capture (MCAP1 = "1")
Count start Count start (TC1S = "10")
TC1 pin input
Internal clock Counter TC1DRB INTTC1 interrupt request
0
1 2 3 4
n+1
n
n+1 n+2 n+3 Capture n
m-2 m-1 m 0 1 Capture m
2
[Application] (1) Cycle/frequency measurement (2) Duty measurement (b) Double-edge capture (MCAP1 = "0")
Figure 8-6 Pulse Width Measurement Mode
Page 94
TMP86PS64FG
8.3.6
Programmable Pulse Generate (PPG) Output Mode
In the programmable pulse generation (PPG) mode, an arbitrary duty pulse is generated by counting performed in the internal clock. To start the timer, TC1CR specifies either the edge of the input pulse to the TC1 pin or the command start. TC1CR specifies whether a duty pulse is produced continuously or not (one-shot pulse). * When TC1CR is set to "0" (Continuous pulse generation) When a match between the up-counter and the TC1DRB value is detected after the timer starts, the level of the PPG pin is inverted and an INTTC1 interrupt request is generated. The up-counter continues counting. When a match between the up-counter and the TC1DRA value is detected, the level of the PPG pin is inverted and an INTTC1 interrupt request is generated. The up-counter is cleared at this time, and then continues counting and pulse generation. When TC1S is cleared to "00" during PPG output, the PPG pin retains the level immediately before the counter stops. * When TC1CR is set to "1" (One-shot pulse generation) When a match between the up-counter and the TC1DRB value is detected after the timer starts, the level of the PPG pin is inverted and an INTTC1 interrupt request is generated. The up-counter continues counting. When a match between the up-counter and the TC1DRA value is detected, the level of the PPG pin is inverted and an INTTC1 interrupt request is generated. TC1CR is cleared to "00" automatically at this time, and the timer stops. The pulse generated by PPG retains the same level as that when the timer stops.
Since the output level of the PPG pin can be set with TC1CR when the timer starts, a positive or negative pulse can be generated. Since the inverted level of the timer F/F1 output level is output to the PPG pin, specify TC1CR to "0" to set the high level to the PPG pin, and "1" to set the low level to the PPG pin. Upon reset, the timer F/F1 is initialized to "0".
Note 1: To change TC1DRA or TC1DRB during a run of the timer, set a value sufficiently larger than the count value of the counter. Setting a value smaller than the count value of the counter during a run of the timer may generate a pulse different from that specified. Note 2: Do not change TC1CR during a run of the timer. TC1CR can be set correctly only at initialization (after reset). When the timer stops during PPG, TC1CR can not be set correctly from this point onward if the PPG output has the level which is inverted of the level when the timer starts. (Setting TC1CR specifies the timer F/F1 to the level inverted of the programmed value.) Therefore, the timer F/F1 needs to be initialized to ensure an arbitrary level of the PPG output. To initialize the timer F/F1, change TC1CR to the timer mode (it is not required to start the timer mode), and then set the PPG mode. Set TC1CR at this time. Note 3: In the PPG mode, the following relationship must be satisfied. TC1DRA > TC1DRB Note 4: Set TC1DRB after changing the mode of TC1M to the PPG mode.
Page 95
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
Example :Generating a pulse which is high-going for 800 s and low-going for 200 s (fc = 16 MHz, CGCR = "0")
Setting port LD LDW LDW LD (TC1CR), 10000111B (TC1DRA), 007DH (TC1DRB), 0019H (TC1CR), 10010111B ; Sets the PPG mode, selects the source clock ; Sets the cycle (1 ms / 27/fc ms = 007DH) ; Sets the low-level pulse width (200 s / 27/fc = 0019H) ; Starts the timer
Example :After stopping PPG, setting the PPG pin to a high-level to restart PPG (fc = 16 MHz, CGCR = "0")
Setting port LD LDW LDW LD : LD LD LD LD (TC1CR), 10000111B (TC1DRA), 007DH (TC1DRB), 0019H (TC1CR), 10010111B : (TC1CR), 10000111B (TC1CR), 10000100B (TC1CR), 00000111B (TC1CR), 00010111B ; Stops the timer ; Sets the timer mode ; Sets the PPG mode, TFF1 = 0 ; Starts the timer ; Sets the PPG mode, selects the source clock ; Sets the cycle (1 ms / 27/fc s = 007DH) ; Sets the low-level pulse width (200 s / 27/fc = 0019H) ; Starts the timer
I/O port output latch shared with PPG output
Port output enable
PPG pin
Data output
D R
Q
Function output
TC1CR Write to TC1CR Internal reset Match to TC1DRB Match to TC1DRA
Set Clear Toggle Q
Timer F/F1
INTTC1 interrupt request
TC1CR clear
Figure 8-7 PPG Output
Page 96
TMP86PS64FG
Timer start
Internal clock
Counter
0
1
2
n
n+1
m0
1
2
n
n+1
m0
1
2
TC1DRB
n
Match detect
TC1DRA
m
PPG pin output INTTC1 interrupt request
Note: m > n
(a) Continuous pulse generation (TC1S = 01)
Count start
TC1 pin input
Trigger
Internal clock
Counter
0
1
n
n+1
m
0
TC1DRB
n
TC1DRA
m
PPG pin output
INTTC1 interrupt request
[Application] One-shot pulse output
(b) One-shot pulse generation (TC1S = 10)
Note: m > n
Figure 8-8 PPG Mode Timing Chart
Page 97
8. 16-Bit TimerCounter 1 (TC1)
8.3 Function TMP86PS64FG
Page 98
TMP86PS64FG
9. 16-Bit Timer/Counter2 (TC2)
9.1 Configuration
TC2S
H
Window
TC2 pin
23
Port (Note)
24, 15
fc/2 , fc/2 fs/2 fc/213, fc/214, fs/25 fc/28, fc/29 fc/23, fc/24
fc fs
A B C D E F S
B
Timer/ event counter
Clear
Y A S
Source clock
16-bit up counter
TC2M
CMP
Match
INTTC2 interrupt
3 TC2CK
TC2S
TC2CR
TC2DR
16-bit timer register 2
TC2 control register
Note: When control input/output is used, I/O port setting should be set correctly. For details, refer to the section "I/O ports".
Figure 9-1 Timer/Counter2 (TC2)
Page 99
9. 16-Bit Timer/Counter2 (TC2)
9.2 Control TMP86PS64FG
9.2 Control
The timer/counter 2 is controlled by a timer/counter 2 control register (TC2CR) and a 16-bit timer register 2 (TC2DR).
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TC2DR (0025H, 0024H)
TC2DRH (0025H) (Initial value: 1111 1111 1111 1111)
TC2DRL (0024H) R/W
TC2CR (0013H)
7
6
5 TC2S
4
3 TC2CK
2
1
0 TC2M (Initial value: **00 00*0)
TC2S
TC2 start control
0:Stop and counter clear 1:Start NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 000 001 fc/2
23
R/W
DV7CK = 1 DV1CK = 0 fs/2
15
Divider
SLOW1/2 mode fs/215 fs/25 - - fc (Note7) -
SLEEP1/2 mode fs/215 fs/25 - - - - R/W
DV1CK = 1 fc/2
24
DV1CK = 1 fs/215 fs/25 fc/29 fc/24 - fs DV21 DV11 DV6 DV1 - -
fc/213 fc/28 fc/23 - fs
fc/214 fc/29 fc/24 - fs
fs/25 fc/28 fc/23 - fs
TC2CK
TC2 source clock select Unit : [Hz]
010 011 100 101 110 111
Reserved External clock (TC2 pin input) R/W
TC2M
TC2 operating mode select
0:Timer/event counter mode 1:Window mode
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 2: When writing to the Timer Register 2 (TC2DR), always write to the lower side (TC2DRL) and then the upper side (TC2DRH) in that order. Writing to only the lower side (TC2DRL) or the upper side (TC2DRH) has no effect. Note 3: The timer register 2 (TC2DR) uses the value previously set in it for coincidence detection until data is written to the upper side (TC2DRH) after writing data to the lower side (TC2DRL). Note 4: Set the mode and source clock when the TC2 stops (TC2S = 0). Note 5: Values to be loaded to the timer register must satisfy the following condition. TC2DR > 1 (TC2DR15 to TC2DR11 > 1 at warm up) Note 6: If a read instruction is executed for TC2CR, read data of bit 7, 6 and 1 are unstable. Note 7: The high-frequency clock (fc) canbe selected only when the time mode at SLOW2 mode is selected. Note 8: On entering STOP mode, the TC2 start control (TC2S) is cleared to "0" automatically. So, the timer stops. Once the STOP mode has been released, to start using the timer counter, set TC2S again.
Page 100
TMP86PS64FG
9.3 Function
The timer/counter 2 has three operating modes: timer, event counter and window modes. And if fc or fs is selected as the source clock in timer mode, when switching the timer mode from SLOW1 to NORMAL2, the timer/counter2 can generate warm-up time until the oscillator is stable.
9.3.1
Timer mode
In this mode, the internal clock is used for counting up. The contents of TC2DR are compared with the contents of up counter. If a match is found, a timer/counter 2 interrupt (INTTC2) is generated, and the counter is cleared. Counting up is resumed after the counter is cleared. When fc is selected for source clock at SLOW2 mode, lower 11-bits of TC2DR are ignored and generated a interrupt by matching upper 5-bits only. Though, in this situation, it is necessary to set TC2DRH only.
Table 9-1 Source Clock (Internal clock) for Timer/Counter2 (at fc = 16 MHz, DV7CK=0)
TC2C K DV1CK = 0 Maximum Time Setting 9.54 [h] 33.55 [s] 1.05 [s] 32.77 [ms] - 2 [s] NORMAL1/2, IDLE1/2 mode SLOW1/2 mode DV7CK = 0 DV1CK = 1 Maximum Time Setting 19.1 [h] 1.12 [min] 2.09 [s] 65.5 [ms] - 2 [s] DV1CK = 0 Maximum Time Setting 18.2 [h] 1.07 [min] 1.05 [s] 32.77 [ms] - 2 [s] DV7CK = 1 DV1CK = 1 Maximum Time Setting 18.2 [h] 1.07 [min] 2.10 [s] 65.5 [ms] - 2 [s] Maximum Time Setting 18.2 [h] 1.07 [min] - - - - Maximum Time Setting 18.2 [h] 1.07 [min] - - - - SLEEP1/2 mode
Resolution
Resolution
Resolution
Resolution
Resolution
Resolution
000 001 010 011 100 101
524.29 [ms] 512.0 [s] 16.0 [s] 0.5 [s] - 30.52 [s]
1.05 [s] 1.02 [ms] 32 [s] 1.0 [s] - 30.52 [s]
1 [s] 0.98 [ms] 16.0 [s] 0.5 [s] - 30.52 [s]
1 [s] 0.98 [ms] 32.0 [s] 1.0 [s] - 30.52 [s]
1 [s] 0.98 [ms] - - 62.5 [ns] -
1 [s] 0.98 [ms] - - - -
Note:When fc is selected as the source clock in timer mode, it is used at warm-up for switching from SLOW1 mode to NORMAL2 mode.
Example :Sets the timer mode with source clock fc/23 [Hz] and generates an interrupt every 25 ms (at fc = 16 MHz, CGCR = "0" )
LDW DI SET EI LD LD (TC2CR), 00001000B (TC2CR), 00101000B (EIRH). 4 (TC2DR), 061AH ; Sets TC2DR (25 ms 28/fc = 061AH) ; IMF= "0" ; Enables INTTC2 interrupt ; IMF= "1" ; Source clock / mode select ; Starts Timer
Page 101
9. 16-Bit Timer/Counter2 (TC2)
9.3 Function TMP86PS64FG
Timer start
Source clock Up-counter
0
1
2
3
4
Match detect
n0
1
2
3
Counter clear
TC2DR
INTTC2 interrupt
Figure 9-2 Timer Mode Timing Chart
Page 102
TMP86PS64FG
9.3.2
Event counter mode
In this mode, events are counted on the rising edge of the TC2 pin input. The contents of TC2DR are compared with the contents of the up counter. If a match is found, an INTTC2 interrupt is generated, and the counter is cleared. Counting up is resumed every the rising edge of the TC2 pin input after the up counter is cleared. Match detect is executed on the falling edge of the TC2 pin. Therefore, an INTTC2 interrupt is generated at the falling edge after the match of TC2DR and up counter. The minimum input pulse width of TC2 pin is shown in Table 9-2. Two or more machine cycles are required for both the "H" and "L" levels of the pulse width.
Example :Sets the event counter mode and generates an INTTC2 interrupt 640 counts later.
LDW DI SET EI LD LD (TC2CR), 00011100B (TC2CR), 00111100B (EIRH). 4 (TC2DR), 640 ; Sets TC2DR ; IMF= "0" ;Enables INTTC2 interrupt ; IMF= "1" ; TC2 source vclock / mode select ; Starts TC2
Table 9-2 Timer/Counter 2 External Input Clock Pulse Width
Minimum Input Pulse Width [s] NORMAL1/2, IDLE1/2 mode "H" width "L" width 23/fc 23/fc SLOW1/2, SLEEP1/2 mode 23/fs 23/fs
Timer start
TC2 pin input
Counter
0
1
2
3
n
0
1
2
3
Match detect
Counter clear
TC2DR
n
INTTC2 interrupt
Figure 9-3 Event Counter Mode Timing Chart 9.3.3 Window mode
In this mode, counting up performed on the rising edge of an internal clock during TC2 external pin input (Window pulse) is "H" level. The contents of TC2DR are compared with the contents of up counter. If a match found, an INTTC2 interrupt is generated, and the up-counter is cleared. The maximum applied frequency (TC2 input) must be considerably slower than the selected internal clock by the TC2CR.
Note:It is not available window mode in the SLOW/SLEEP mode. Therefore, at the window mode in NORMAL mode, the timer should be halted by setting TC2CR to "0" before the SLOW/SLEEP mode is entered.
Page 103
9. 16-Bit Timer/Counter2 (TC2)
9.3 Function TMP86PS64FG
Example :Generates an interrupt, inputting "H" level pulse width of 120 ms or more. (at fc = 16 MHz, TBTCR = "0" , CGCR = "0")
LDW DI SET EI LD LD (TC2CR), 00000101B (TC2CR), 00100101B (EIRH). 4 (TC2DR), 00EAH ; Sets TC2DR (120 ms 213/fc = 00EAH) ; IMF= "0" ; Enables INTTC2 interrupt ; IMF= "1" ; TC2sorce clock / mode select ; Starts TC2
Timer start
TC2 pin input
Internal clock Counter TC2DR
Match detect INTTC2 interrupt
1 2 n 0 1 2 3
Counter clear
Figure 9-4 Window Mode Timing Chart
Page 104
TMP86PS64FG
10. 8-Bit TimerCounter 3 (TC3)
10.1 Configuration
Falling
Edge detector
Rising
TC3 pin
TC3S
INTTC3 interrupt Clear
Port (Note)
fc/213, fs/2 5 fc/212, fs/2 4 fc/211 , fs/2 3 fc/210, fs/2 2 fc/29 , fs/2 fc/28 fc/27
H AY B C D E F G S
3
Source clock
8-bit up-counter
Overflow detect
TC3S
CMP
Match detect
A B S
Y
TC3DRB
Capture
TC3DRA
Capture
8-bit timer register
TC3CK
TC3M
TC3CR
TC3 contorol register
Note: Function input may not operate depending on I/O port setting. For more details, see the chapter "I/O Port".
Figure 10-1 TimerCounter 3 (TC3)
ACAP
TC3S
Page 105
10. 8-Bit TimerCounter 3 (TC3)
10.1 Configuration TMP86PS64FG
10.2 TimerCounter Control
The TimerCounter 3 is controlled by the TimerCounter 3 control register (TC3CR) and two 8-bit timer registers (TC3DRA and TC3DRB). Timer Register and Control Register
TC3DRA (0010H) TC3DRB (0011H) 7 6 5 4 3 2 1 0 Read/Write (Initial value: 1111 1111)
Read only (Initial value: 1111 1111)
TC3CR (0012H)
7
6 ACAP
5
4 TC3S
3
2 TC3CK
1
0 TC3M (Initial value: *0*0 0000)
ACAP TC3S
Auto capture control TC3 start control
0: - 1: Auto capture 0: Stop and counter clear 1: Start NORMAL1/2, IDLE1/2 mode DV7CK = 0 000 001 fc/213 fc/212 fc/211 fc/210 fc/29 fc/28 fc/2
7
R/W R/W SLOW1/2, SLEEP1/2 mode fs/25 fs/24 fs/23 fs/22 fs/2 - - R/W
DV7CK = 1 fs/25 fs/24 fs/23 fs/22 fs/2 fc/28 fc/2
7
Divider DV11 DV10 DV9 DV8 DV7 DV6 DV5
TC3CK
TC3 source clock select [Hz]
010 011 100 101 110 111
External clock (TC3 pin input) NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK=0 DV1CK=1 fc/2
14
DV7CK = 1 DV1CK=0 fs/2
5
Divider
DV1CK=1 fs/25 fs/24 fs/23 fs/2
2
SLOW1/2, SLEEP1/2 mode fs/25 fs/24 fs/23 fs/2
2
000 001 TC3CK TC3 source clock select [Hz] 010 011 100 101 110 111 TC3M TC3 operating mode select
fc/2
13
DV11 DV10 DV9 DV8 DV7 DV6 DV5
fc/212 fc/211 fc/2
10
fc/213 fc/212 fc/2
11
fs/24 fs/23 fs/2
2
R/W
fc/29 fc/2
8
fc/210 fc/2
9
fs/2 fc/2
8
fs/2 fc/2
9
fs/2 - -
fc/27
fc/28
fc/27
fc/28
External clock (TC3 pin input) R/W
0: Timer/event counter mode 1: Capture mode
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 2: Set the operating mode and source clock when TimerCounter stops (TC3S = 0). Note 3: To set the timer registers, the following relationship must be satisfied. TC3DRA > 1 (Timer/event counter mode) Note 4: Auto-capture (ACAP) can be used only in the timer and event counter modes. Note 5: When the read instruction is executed to TC3CR, the bit 5 and 7 are read as a don't care. Note 6: Do not program TC3DRA when the timer is running (TC3S = 1). Note 7: When the STOP mode is entered, the start control (TC3S) is cleared to 0 automatically, and the timer stops. After the STOP mode is exited, TC3S must be set again to use the timer counter.
Page 106
TMP86PS64FG
10.3 Function
TimerCounter 3 has three types of operating modes: timer, event counter and capture modes.
10.3.1 Timer mode
In the timer mode, the up-counter counts up using the internal clock. When a match between the up-counter and the timer register 3A (TC3DRA) value is detected, an INTTC3 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting. Setting TC3CR to 1 captures the upcounter value into the timer register B (TC3DRB) with the auto-capture function. The count value during timer operation can be checked by executing the read instruction to TC3DRB.
Note:00H which is stored in the up-counter immediately after detection of a match is not captured into TC3DRB. (Figure 10-2)
Clock TC3DRA Up-counter
Match detect C8
C6
C7
C8
00
01
TC3DRB
C6
C7
C8
01
Note: In the case that TC3DRB is C8H
Figure 10-2 Auto-Capture Function
Page 107
10. 8-Bit TimerCounter 3 (TC3)
10.1 Configuration TMP86PS64FG
Table 10-1 Source Clock for TimerCounter 3 (Example: fc = 16 MHz, fs = 32.768 kHz)
TC3CK DV7CK = 0 DV1CK = 0 Resolution [s] 000 001 010 011 100 101 110 512 256 128 64 32 16 8 Maximum Time Setting [ms] 130.6 65.3 32.6 16.3 8.2 4.1 2.0 Resolution [s] 000 001 010 011 100 101 110 512 256 128 64 32 16 8 DV1CK = 1 Resolution [s] 1024 512 256 128 64 32 16 Maximum Time Setting [ms] 261.1 130.6 65.3 32.6 16.3 8.2 4.1 DV1CK = 0 Resolution [s] 976.56 488.28 244.14 122.07 61.01 16.0 8.0 Maximum Time Setting [ms] 249.0 124.5 62.3 31.1 15.6 4.1 2.0 Resolution [s] 976.56 488.28 244.14 122.07 61.01 16.0 8.0 NORMAL1/2, IDLE1/2 mode DV7CK = 1 DV1CK = 1 Resolution [s] 976.56 488.28 244.14 122.07 61.01 32.0 16.0 Maximum Time Setting [ms] 249.0 124.5 62.3 31.1 15.6 8.2 4.1 Resolution [s] 976.56 488.28 244.14 122.07 61.01 - - Resolution [s] 976.56 488.28 244.14 122.07 61.01 - - Resolution [ms] 249.0 124.5 62.3 31.1 15.6 - - Maximum Time Setting [ms] 249.0 124.5 62.3 31.1 15.6 - - SLOW1/2, SLEEP1/2 mode
Maximum Time Setting [ms] 130.6 65.3 32.6 16.3 8.2 4.1 2.0
Maximum Time Setting [ms] 249.0 124.5 62.3 31.1 15.6 4.1 2.0
Timer start Source clock Counter
0
1
2
3
4
n0
1
2
3
4
5
6
7
TC3DRA INTTC3 interrupt
?
n
Match detect
Counter clear
(a)
Timer mode
Source clock Counter
m m+1 m+2 n n+1
Capture
Capture
m+1 m+2
n
TC3DRB
?
m
n+1
TC3CR (b) Auto capture
Figure 10-3 Timer Mode Timing Chart
Page 108
TMP86PS64FG
10.3.2 Event Counter Mode
In the event counter mode, the up-counter counts up at the rising edge of the input pulse to the TC3 pin. When a match between the up-counter and TC3DRA value is detected, an INTTC3 interrupt is generated and up-counter is cleared. After being cleared, the up-counter restarts counting at each rising edge of the input pulse to the TC3 pin. Since a match is detected at the falling edge of the input pulse to TC3 pin, an INTTC3 interrupt request is generated at the falling edge immediately after the up-counter reaches the value set in TC3DRA. The maximum applied frequencies are shown in Table 10-2. The pulse width larger than one machine cycle is required for high-going and low-going pulses. Setting TC3CR to 1 captures the up-counter value into TC3DRB with the auto-capture function. The count value during a timer operation can be checked by the read instruction to TC3DRB.
Note:00H which is stored in the up-counter immediately after detection of a match is not captured into TC3DRB. (Figure 10-2)
Example :Inputting 50 Hz pulse to TC3, and generating interrupts every 0.5 s
LD LD LD (TC3CR), 00001110B (TC3DRA), 19H (TC3CR), 00011110B : Sets the clock mode : 0.5 s / 1/50 = 25 = 19H : Starts TC3.
Table 10-2 Maximum Frequencies Applied to TC3
Minimum Pulse Width NORMAL1/2, IDLE1/2 mode High-going Low-going 22/fc 22/fc SLOW1/2, SLEEP1/2 mode 22/fs 22/fs
Timer start
TC3 pin input Counter
0
1
2
3
n
0
1
2
3
Match detect
Counter clear
TC3DRA
n
INTTC3 interrupt
Figure 10-4 Event Counter Mode Timing Chart
Page 109
10. 8-Bit TimerCounter 3 (TC3)
10.1 Configuration TMP86PS64FG
10.3.3 Capture Mode
In the capture mode, the pulse width, frequency and duty cycle of the pulse input to the TC3 pin are measured with the internal clock. The capture mode is used to decode remote control signals, and identify AC50/60 Hz. When the falling edge of the TC3 input is detected after the timer starts, the up-counter value is captured into TC3DRB. Hereafter, whenever the rising edge is detected, the up-counter value is captured into TC3DRA and the INTTC3 interrupt request is generated. The up-counter is cleared at this time. Generally, read TC3DRB and TC3DRA during INTTC3 interrupt processing. After the up-counter is cleared, counting is continued and the next up-counter value is captured into TC3DRB. When the rising edge is detected immediately after the timer starts, the up-counter value is captured into TC3DRA only, but not into TC3DRB. The INTTC3 interrupt request is generated. When the read instruction is executed to TC3DRB at this time, the value at the completion of the last capture (FF immediately after a reset) is read. The minimum input pulse width must be larger than one cycle width of the source clock programmed in TC3CR. The INTTC3 interrupt request is generated if the up-counter overflow (FFH) occurs during capture operation before the edge is detected. TC3DRA is set to FFH and the up-counter is cleared. Counting is continued by the up-counter, but capture operation and overflow detection are stopped until TC3DRA is read. Generally, read TC3DRB first because capture operation and overflow detection resume by reading TC3DRA.
Timer start
TC3CR
Source clock Counter TC3 pin input
Internal waveform
0 1
i-1 i i+1
k-1 k 0
1
m-1
m
m+1
n-1 n 0
1
2
3
FE FF 0
1
2
3
Capture TC3DRA TC3DRB INTTC3 interrupt request Read of TC3DRA Capture i k Capture m
Capture n Capture
FE
FF (Overflow)
Overflow
Figure 10-5 Capture Mode Timing Chart
Page 110
TMP86PS64FG
11. 8-Bit TimerCounter 4 (TC4)
11.1 Configuration
TC4S
fc/211, fc212 or fs/23 fc/27, fc28 fc/25, fc26 fc/23, fc24 fc/22, fc23 fc/2, fc22 fc, fc/2
(Note)
A B Source C Clock Clear D EY 8-bit up-counter Y F G H
Overflow detect
0 1 S Y
TC4 pin
S
3
CMP
Match detect
Timer F/F
TC4CK
Toggle
Port (Note)
TC4S
TC4M
2
0 Y
1
Clear
S
PWM4/ PDO4/ pin
TC4CR
TC4DR
PWM output mode
TC4S
INTTC4 interrupt
PDO mode
Note: Function I/O may not operate depending on I/O port setting. For more details, see the chapter "I/O Port".
Figure 11-1 TimerCounter 4 (TC4)
Page 111
11. 8-Bit TimerCounter 4 (TC4)
11.1 Configuration TMP86PS64FG
11.2 TimerCounter Control
The TimerCounter 4 is controlled by the TimerCounter 4 control register (TC4CR) and timer registers 4 (TC4DR). Timer Register and Control Register
TC4DR (0018) 7 6 5 4 3 2 1 0 Read/Write (Initial value: 1111 1111)
TC4CR (0014)
7
6
5 TC4S
4
3 TC4CK
2
1 TC4M
0 Read/Write (Initial value: **00 0000)
TC4S
TC4 start control
0: Stop and counter clear 1: Start NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 000 001 fc/211 fc/27 fc/25 fc/2
3
R/W SLOW1/2, SLEEP1/2 mode fs/23 - - - - - - R/W
DV7CK = 1 DV1CK = 0 fs/23 fc/27 fc/25 fc/2
3
Divider
DV1CK = 1 fc/212 fc/28 fc/26 fc/2
4
DV1CK = 1 fs/23 fc/28 fc/26 fc/2
4
DV9 DV5 DV3 DV1 - - -
TC4CK
TC4 source clock select [Hz]
010 011 100 101 110 111
fc/22 fc/2 fc
fc/23 fc/22 fc/2
fc/22 fc/2 fc
fc/23 fc/22 fc/2
External clock (TC4 pin input)
TC4M
TC4 operating mode select
00: Timer/event counter mode 01: Reserved 10: Programmable divider output (PDO) mode 11: Pulse width modulation (PWM) output mode
R/W
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 2: To set the timer registers, the following relationship must be satisfied. 1 TC4DR 255 Note 3: To start timer operation (TC4S = 0 1) or disable timer operation (TC4S = 1 0), do not change the TC4CR setting. During timer operation (TC4S = 1 1), do not change it, either. If the setting is programmed during timer operation, counting is not performed correctly. Note 4: The event counter and PWM output modes are used only in the NOMAL1/2 and IDLE1/2 modes. Note 5: When the STOP mode is entered, the start control (TC4S) is cleared to "0" automatically. Note 6: The bit 6 and 7 of TC4CR are read as a don't care when these bits are read. Note 7: In the timer, event counter and PDO modes, do not change the TC4DR setting when the timer is running. Note 8: When the high-frequency clock fc exceeds 10 MHz, do not select the source clock of TC4CK = 110. Note 9: The operating clock fs can not be used in NORMAL1 or IDEL1 mode (when low-frequency oscillation is stopped.) Note 10:For available source clocks depending on the operation mode, refer to the following table.
Timer Mode 000 001 010 TC4CK 011 100 101 110 111 O O O O - - - -
Event Counter Mode - - - - - - - O
PDO Mode O O O - - - - -
PWM Mode - - - O O O O x
Page 112
TMP86PS64FG
Note: O : Available source clock
Page 113
11. 8-Bit TimerCounter 4 (TC4)
11.1 Configuration TMP86PS64FG
11.3 Function
TimerCounter 4 has four types of operating modes: timer, event counter, programmable divider output (PDO), and pulse width modulation (PWM) output modes.
11.3.1 Timer Mode
In the timer mode, the up-counter counts up using the internal clock. When a match between the up-counter and the TC4DR value is detected, an INTTC4 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting. Table 11-1 Source Clock for TimerCounter 4 (Example: fc = 16 MHz, fs = 32.768 kHz)
NORMAL1/2, IDLE1/2 Mode TC4CK DV1CK = 0 Maximum Time Setting [ms] 32.6 2.0 0.510 0.128 DV7CK = 0 DV1CK = 1 Maximum Time Setting [ms] 65.3 4.1 1.0 0.255 DV1CK = 0 Maximum Time Setting [ms] 62.2 2.0 0.510 0.128 DV7CK = 1 DV1CK = 1 Maximum Time Setting [ms] 62.2 4.1 1.0 0.255 Maximum Time Setting [ms] 62.2 - - - SLOW1/2, SLEEP1/2 Mode
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
000 001 010 011
128.0 8.0 2.0 0.5
256.0 16.0 4.0 1.0
244.14 8.0 2.0 0.5
244.14 16.0 4.0 1.0
244.14 - - -
Page 114
TMP86PS64FG
11.3.2 Event Counter Mode
In the event counter mode, the up-counter counts up at the rising edge of the input pulse to the TC4 pin. When a match between the up-counter and the TC4DR value is detected, an INTTC4 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting at rising edge of the TC4 pin. Since a match is detected at the falling edge of the input pulse to the TC4 pin, the INTTC4 interrupt request is generated at the falling edge immediately after the up-counter reaches the value set in TC4DR. The minimum pulse width applied to the TC4 pin are shown in Table 11-2. The pulse width larger than two machine cycles is required for high- and low-going pulses.
Note:The event counter mode can not used in the SLOW1/2 and SLEEP1/2 modes since the external clock is not supplied in these modes.
Table 11-2 External Source Clock for TimerCounter 4
Minimum Pulse Width NORMAL1/2, IDLE1/2 mode High-going Low-going 23/fc 23/fc
Page 115
11. 8-Bit TimerCounter 4 (TC4)
11.1 Configuration TMP86PS64FG
11.3.3 Programmable Divider Output (PDO) Mode
The programmable divider output (PDO) mode is used to generated a pulse with a 50% duty cycle by counting with the internal clock. When a match between the up-counter and the TC4DR value is detected, the logic level output from the PDO4 pin is switched to the opposite state and INTTC4 interrupt request is generated. The up-counter is cleared at this time and then counting is continued. When a match between the up-counter and the TC4DR value is detected, the logic level output from the PDO4 pin is switched to the opposite state again and INTTC4 interrupt request is generated. The up-counter is cleared at this time, and then counting and PDO are continued. When the timer is stopped, the PDO4 pin is high. Therefore, if the timer is stopped when the PDO4 pin is low, the duty pulse may be shorter than the programmed value.
Example :Generating 1024 Hz pulse (fc = 16.0 Mhz)
LD LD LD (TC4CR), 00000110B (TC4DR), 3DH (TC4CR), 00100110B : Sets the PDO mode. (TC4M = 10, TC4CK = 001) : 1/1024 / 27/fc / 2 (half cycle period) = 3DH : Start TC4
Internal clock
Counter
TC4DR Timer F/F
0
1
2
n0
1
2
n0
1
2
n0
1
2
n0
1
n
Match detect
PDO4 pin INTTC4 interrupt request
Figure 11-2 PDO Mode Timing Chart
Page 116
TMP86PS64FG
11.3.4 Pulse Width Modulation (PWM) Output Mode
The pulse width modulation (PWM) output mode is used to generate the PWM pulse with up to 8 bits of resolution by an internal clock. When a match between the up-counter and the TC4DR value is detected, the logic level output from the
PWM4 pin becomes low. The up-counter continues counting. When the up-counter overflow occurs, the PWM4
pin becomes high. The INTTC4 interrupt request is generated at this time. When the timer is stopped, the PWM4 pin is high. Therefore, if the timer is stopped when the PWM4 pin is low, one PMW cycle may be shorter than the programmed value. TC4DR is serially connected to the shift register. If TC4DR is programmed during PWM output, the data set to TC4DR is not shifted until one PWM cycle is completed. Therefore, a pulse can be modulated periodically. For the first time, the data written to TC4DR is shifted when the timer is started by setting TC4CR to 1.
Note 1: The PWM output mode can be used only in the NORMAL1/2 and IDEL 1/2 modes. Note 2: In the PWM output mode, program TC4DR immediately after the INTTC4 interrupt request is generated (typically in the INTTC4 interrupt service routine.) When the programming of TC4DR and the INTTC4 interrupt occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next INTTC4 interrupt request is issued.
TC4CR
Internal clock
Counter
TC4DR
0
1
n
n+1
FF
0
1
n
n+1
FF
0
1
m
Rewrite
? n m
Rewrite
p
Rewrite Data shift
m
Data shift Shift register
Timer F/F
? n
Data shift
Match detect
Match detect
Match detect
PWM4 pin INTTC4 interrupt request
n
n
m
PWM cycle
Figure 11-3 PWM output Mode Timing Chart (TC4)
Page 117
11. 8-Bit TimerCounter 4 (TC4)
11.1 Configuration TMP86PS64FG
Table 11-3 PWM Mode (Example: fc = 16 MHz)
NORMAL1/2, IDLE1/2 Mode TC4CK DV1CK = 0 Resolution [ns] 000 001 010 011 100 101 110 - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 0 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 - DV1CK = 0 Resolution [ns] - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 1 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 -
Page 118
TMP86PS64FG
12. 8-Bit TimerCounter 5 (TC5)
12.1 Configuration
TC5S
fc/211, fc212 or fs/23 fc/27, fc28 fc/25, fc26 fc/23, fc24 fc/22, fc23 fc/2, fc22 fc, fc/2
(Note)
A B Source C Clock Clear D EY 8-bit up-counter Y F G H
Overflow detect
0 1 S Y
TC5 pin
S
3
CMP
Match detect
Timer F/F
TC5CK
Toggle
Port (Note)
TC5S
TC5M
2
0 Y
1
Clear
S
PWM5/ PDO5/ pin
TC5CR
TC5DR
PWM output mode
TC5S
INTTC5 interrupt
PDO mode
Note: Function I/O may not operate depending on I/O port setting. For more details, see the chapter "I/O Port".
Figure 12-1 TimerCounter 5 (TC5)
Page 119
12. 8-Bit TimerCounter 5 (TC5)
12.1 Configuration TMP86PS64FG
12.2 TimerCounter Control
The TimerCounter 5 is controlled by the TimerCounter 5 control register (TC5CR) and timer registers 5 (TC5DR). Timer Register and Control Register
TC5DR (0019) 7 6 5 4 3 2 1 0 Read/Write (Initial value: 1111 1111)
TC5CR (0015)
7
6
5 TC5S
4
3 TC5CK
2
1 TC5M
0 Read/Write (Initial value: **00 0000)
TC5S
TC5 start control
0: Stop and counter clear 1: Start NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 000 001 fc/211 fc/27 fc/25 fc/2
3
R/W SLOW1/2, SLEEP1/2 mode fs/23 - - - - - - R/W
DV7CK = 1 DV1CK = 0 fs/23 fc/27 fc/25 fc/2
3
Divider
DV1CK = 1 fc/212 fc/28 fc/26 fc/2
4
DV1CK = 1 fs/23 fc/28 fc/26 fc/2
4
DV9 DV5 DV3 DV1 - - -
TC5CK
TC5 source clock select [Hz]
010 011 100 101 110 111
fc/22 fc/2 fc
fc/23 fc/22 fc/2
fc/22 fc/2 fc
fc/23 fc/22 fc/2
External clock (TC5 pin input)
TC5M
TC5 operating mode select
00: Timer/event counter mode 01: Reserved 10: Programmable divider output (PDO) mode 11: Pulse width modulation (PWM) output mode
R/W
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 2: To set the timer registers, the following relationship must be satisfied. 1 TC5DR 255 Note 3: To start timer operation (TC5S = 0 1) or disable timer operation (TC5S = 1 0), do not change the TC5CR setting. During timer operation (TC5S = 1 1), do not change it, either. If the setting is programmed during timer operation, counting is not performed correctly. Note 4: The event counter and PWM output modes are used only in the NOMAL1/2 and IDLE1/2 modes. Note 5: When the STOP mode is entered, the start control (TC5S) is cleared to "0" automatically. Note 6: The bit 6 and 7 of TC5CR are read as a don't care when these bits are read. Note 7: In the timer, event counter and PDO modes, do not change the TC5DR setting when the timer is running. Note 8: When the high-frequency clock fc exceeds 10 MHz, do not select the source clock of TC5CK = 110. Note 9: The operating clock fs can not be used in NORMAL1 or IDEL1 mode (when low-frequency oscillation is stopped.) Note 10:For available source clocks depending on the operation mode, refer to the following table.
Timer Mode 000 001 010 TC5CK 011 100 101 110 111 O O O O - - - -
Event Counter Mode - - - - - - - O
PDO Mode O O O - - - - -
PWM Mode - - - O O O O x
Page 120
TMP86PS64FG
Note: O : Available source clock
Page 121
12. 8-Bit TimerCounter 5 (TC5)
12.1 Configuration TMP86PS64FG
12.3 Function
TimerCounter 5 has four types of operating modes: timer, event counter, programmable divider output (PDO), and pulse width modulation (PWM) output modes.
12.3.1 Timer Mode
In the timer mode, the up-counter counts up using the internal clock. When a match between the up-counter and the TC5DR value is detected, an INTTC5 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting. Table 12-1 Source Clock for TimerCounter 5 (Example: fc = 16 MHz, fs = 32.768 kHz)
NORMAL1/2, IDLE1/2 Mode TC5CK DV1CK = 0 Maximum Time Setting [ms] 32.6 2.0 0.510 0.128 DV7CK = 0 DV1CK = 1 Maximum Time Setting [ms] 65.3 4.1 1.0 0.255 DV1CK = 0 Maximum Time Setting [ms] 62.2 2.0 0.510 0.128 DV7CK = 1 DV1CK = 1 Maximum Time Setting [ms] 62.2 4.1 1.0 0.255 Maximum Time Setting [ms] 62.2 - - - SLOW1/2, SLEEP1/2 Mode
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
000 001 010 011
128.0 8.0 2.0 0.5
256.0 16.0 4.0 1.0
244.14 8.0 2.0 0.5
244.14 16.0 4.0 1.0
244.14 - - -
Page 122
TMP86PS64FG
12.3.2 Event Counter Mode
In the event counter mode, the up-counter counts up at the rising edge of the input pulse to the TC5 pin. When a match between the up-counter and the TC5DR value is detected, an INTTC5 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting at rising edge of the TC5 pin. Since a match is detected at the falling edge of the input pulse to the TC5 pin, the INTTC5 interrupt request is generated at the falling edge immediately after the up-counter reaches the value set in TC5DR. The minimum pulse width applied to the TC5 pin are shown in Table 12-2. The pulse width larger than two machine cycles is required for high- and low-going pulses.
Note:The event counter mode can not used in the SLOW1/2 and SLEEP1/2 modes since the external clock is not supplied in these modes.
Table 12-2 External Source Clock for TimerCounter 5
Minimum Pulse Width NORMAL1/2, IDLE1/2 mode High-going Low-going 23/fc 23/fc
Page 123
12. 8-Bit TimerCounter 5 (TC5)
12.1 Configuration TMP86PS64FG
12.3.3 Programmable Divider Output (PDO) Mode
The programmable divider output (PDO) mode is used to generated a pulse with a 50% duty cycle by counting with the internal clock. When a match between the up-counter and the TC5DR value is detected, the logic level output from the PDO5 pin is switched to the opposite state and INTTC5 interrupt request is generated. The up-counter is cleared at this time and then counting is continued. When a match between the up-counter and the TC5DR value is detected, the logic level output from the PDO5 pin is switched to the opposite state again and INTTC5 interrupt request is generated. The up-counter is cleared at this time, and then counting and PDO are continued. When the timer is stopped, the PDO5 pin is high. Therefore, if the timer is stopped when the PDO5 pin is low, the duty pulse may be shorter than the programmed value.
Example :Generating 1024 Hz pulse (fc = 16.0 Mhz)
LD LD LD (TC5CR), 00000110B (TC5DR), 3DH (TC5CR), 00100110B : Sets the PDO mode. (TC5M = 10, TC5CK = 001) : 1/1024 / 27/fc / 2 (half cycle period) = 3DH : Start TC5
Internal clock
Counter
TC5DR Timer F/F
0
1
2
n0
1
2
n0
1
2
n0
1
2
n0
1
n
Match detect
PDO5 pin INTTC5 interrupt request
Figure 12-2 PDO Mode Timing Chart
Page 124
TMP86PS64FG
12.3.4 Pulse Width Modulation (PWM) Output Mode
The pulse width modulation (PWM) output mode is used to generate the PWM pulse with up to 8 bits of resolution by an internal clock. When a match between the up-counter and the TC5DR value is detected, the logic level output from the
PWM5 pin becomes low. The up-counter continues counting. When the up-counter overflow occurs, the PWM5
pin becomes high. The INTTC5 interrupt request is generated at this time. When the timer is stopped, the PWM5 pin is high. Therefore, if the timer is stopped when the PWM5 pin is low, one PMW cycle may be shorter than the programmed value. TC5DR is serially connected to the shift register. If TC5DR is programmed during PWM output, the data set to TC5DR is not shifted until one PWM cycle is completed. Therefore, a pulse can be modulated periodically. For the first time, the data written to TC5DR is shifted when the timer is started by setting TC5CR to 1.
Note 1: The PWM output mode can be used only in the NORMAL1/2 and IDEL 1/2 modes. Note 2: In the PWM output mode, program TC5DR immediately after the INTTC5 interrupt request is generated (typically in the INTTC5 interrupt service routine.) When the programming of TC5DR and the INTTC5 interrupt occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next INTTC5 interrupt request is issued.
TC5CR
Internal clock
Counter
TC5DR
0
1
n
n+1
FF
0
1
n
n+1
FF
0
1
m
Rewrite
? n m
Rewrite
p
Rewrite Data shift
m
Data shift Shift register
Timer F/F
? n
Data shift
Match detect
Match detect
Match detect
PWM5 pin INTTC5 interrupt request
n
n
m
PWM cycle
Figure 12-3 PWM output Mode Timing Chart (TC5)
Page 125
12. 8-Bit TimerCounter 5 (TC5)
12.1 Configuration TMP86PS64FG
Table 12-3 PWM Mode (Example: fc = 16 MHz)
NORMAL1/2, IDLE1/2 Mode TC5CK DV1CK = 0 Resolution [ns] 000 001 010 011 100 101 110 - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 0 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 - DV1CK = 0 Resolution [ns] - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 1 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 -
Page 126
TMP86PS64FG
13. 8-Bit TimerCounter 6 (TC6)
13.1 Configuration
TC6S
fc/211, fc212 or fs/23 fc/27, fc28 fc/25, fc26 fc/23, fc24 fc/22, fc23 fc/2, fc22 fc, fc/2
(Note)
A B Source C Clock Clear D EY 8-bit up-counter Y F G H
Overflow detect
0 1 S Y
TC6 pin
S
3
CMP
Match detect
Timer F/F
TC6CK
Toggle
Port (Note)
TC6S
TC6M
2
0 Y
1
Clear
S
PWM6/ PDO6/ pin
TC6CR
TC6DR
PWM output mode
TC6S
INTTC6 interrupt
PDO mode
Note: Function I/O may not operate depending on I/O port setting. For more details, see the chapter "I/O Port".
Figure 13-1 TimerCounter 6 (TC6)
Page 127
13. 8-Bit TimerCounter 6 (TC6)
13.1 Configuration TMP86PS64FG
13.2 TimerCounter Control
The TimerCounter 6 is controlled by the TimerCounter 6 control register (TC6CR) and timer registers 6 (TC6DR). Timer Register and Control Register
TC6DR (0017) 7 6 5 4 3 2 1 0 Read/Write (Initial value: 1111 1111)
TC6CR (0016)
7
6
5 TC6S
4
3 TC6CK
2
1 TC6M
0 Read/Write (Initial value: **00 0000)
TC6S
TC6 start control
0: Stop and counter clear 1: Start NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 000 001 fc/211 fc/27 fc/25 fc/2
3
R/W SLOW1/2, SLEEP1/2 mode fs/23 - - - - - - R/W
DV7CK = 1 DV1CK = 0 fs/23 fc/27 fc/25 fc/2
3
Divider
DV1CK = 1 fc/212 fc/28 fc/26 fc/2
4
DV1CK = 1 fs/23 fc/28 fc/26 fc/2
4
DV9 DV5 DV3 DV1 - - -
TC6CK
TC6 source clock select [Hz]
010 011 100 101 110 111
fc/22 fc/2 fc
fc/23 fc/22 fc/2
fc/22 fc/2 fc
fc/23 fc/22 fc/2
External clock (TC6 pin input)
TC6M
TC6 operating mode select
00: Timer/event counter mode 01: Reserved 10: Programmable divider output (PDO) mode 11: Pulse width modulation (PWM) output mode
R/W
Note 1: fc: High-frequency clock [Hz], fs: Low-frequency clock [Hz], *: Don't care Note 2: To set the timer registers, the following relationship must be satisfied. 1 TC6DR 255 Note 3: To start timer operation (TC6S = 0 1) or disable timer operation (TC6S = 1 0), do not change the TC6CR setting. During timer operation (TC6S = 1 1), do not change it, either. If the setting is programmed during timer operation, counting is not performed correctly. Note 4: The event counter and PWM output modes are used only in the NOMAL1/2 and IDLE1/2 modes. Note 5: When the STOP mode is entered, the start control (TC6S) is cleared to "0" automatically. Note 6: The bit 6 and 7 of TC6CR are read as a don't care when these bits are read. Note 7: In the timer, event counter and PDO modes, do not change the TC6DR setting when the timer is running. Note 8: When the high-frequency clock fc exceeds 10 MHz, do not select the source clock of TC6CK = 110. Note 9: The operating clock fs can not be used in NORMAL1 or IDEL1 mode (when low-frequency oscillation is stopped.) Note 10:For available source clocks depending on the operation mode, refer to the following table.
Timer Mode 000 001 010 TC6CK 011 100 101 110 111 O O O O - - - -
Event Counter Mode - - - - - - - O
PDO Mode O O O - - - - -
PWM Mode - - - O O O O x
Page 128
TMP86PS64FG
Note: O : Available source clock
Page 129
13. 8-Bit TimerCounter 6 (TC6)
13.1 Configuration TMP86PS64FG
13.3 Function
TimerCounter 6 has four types of operating modes: timer, event counter, programmable divider output (PDO), and pulse width modulation (PWM) output modes.
13.3.1 Timer Mode
In the timer mode, the up-counter counts up using the internal clock. When a match between the up-counter and the TC6DR value is detected, an INTTC6 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting. Table 13-1 Source Clock for TimerCounter 6 (Example: fc = 16 MHz, fs = 32.768 kHz)
NORMAL1/2, IDLE1/2 Mode TC6CK DV1CK = 0 Maximum Time Setting [ms] 32.6 2.0 0.510 0.128 DV7CK = 0 DV1CK = 1 Maximum Time Setting [ms] 65.3 4.1 1.0 0.255 DV1CK = 0 Maximum Time Setting [ms] 62.2 2.0 0.510 0.128 DV7CK = 1 DV1CK = 1 Maximum Time Setting [ms] 62.2 4.1 1.0 0.255 Maximum Time Setting [ms] 62.2 - - - SLOW1/2, SLEEP1/2 Mode
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
Resolution [s]
000 001 010 011
128.0 8.0 2.0 0.5
256.0 16.0 4.0 1.0
244.14 8.0 2.0 0.5
244.14 16.0 4.0 1.0
244.14 - - -
Page 130
TMP86PS64FG
13.3.2 Event Counter Mode
In the event counter mode, the up-counter counts up at the rising edge of the input pulse to the TC6 pin. When a match between the up-counter and the TC6DR value is detected, an INTTC6 interrupt is generated and the up-counter is cleared. After being cleared, the up-counter restarts counting at rising edge of the TC6 pin. Since a match is detected at the falling edge of the input pulse to the TC6 pin, the INTTC6 interrupt request is generated at the falling edge immediately after the up-counter reaches the value set in TC6DR. The minimum pulse width applied to the TC6 pin are shown in Table 13-2. The pulse width larger than two machine cycles is required for high- and low-going pulses.
Note:The event counter mode can not used in the SLOW1/2 and SLEEP1/2 modes since the external clock is not supplied in these modes.
Table 13-2 External Source Clock for TimerCounter 6
Minimum Pulse Width NORMAL1/2, IDLE1/2 mode High-going Low-going 23/fc 23/fc
Page 131
13. 8-Bit TimerCounter 6 (TC6)
13.1 Configuration TMP86PS64FG
13.3.3 Programmable Divider Output (PDO) Mode
The programmable divider output (PDO) mode is used to generated a pulse with a 50% duty cycle by counting with the internal clock. When a match between the up-counter and the TC6DR value is detected, the logic level output from the PDO6 pin is switched to the opposite state and INTTC6 interrupt request is generated. The up-counter is cleared at this time and then counting is continued. When a match between the up-counter and the TC6DR value is detected, the logic level output from the PDO6 pin is switched to the opposite state again and INTTC6 interrupt request is generated. The up-counter is cleared at this time, and then counting and PDO are continued. When the timer is stopped, the PDO6 pin is high. Therefore, if the timer is stopped when the PDO6 pin is low, the duty pulse may be shorter than the programmed value.
Example :Generating 1024 Hz pulse (fc = 16.0 Mhz)
LD LD LD (TC6CR), 00000110B (TC6DR), 3DH (TC6CR), 00100110B : Sets the PDO mode. (TC6M = 10, TC6CK = 001) : 1/1024 / 27/fc / 2 (half cycle period) = 3DH : Start TC6
Internal clock
Counter
TC6DR Timer F/F
0
1
2
n0
1
2
n0
1
2
n0
1
2
n0
1
n
Match detect
PDO6 pin INTTC6 interrupt request
Figure 13-2 PDO Mode Timing Chart
Page 132
TMP86PS64FG
13.3.4 Pulse Width Modulation (PWM) Output Mode
The pulse width modulation (PWM) output mode is used to generate the PWM pulse with up to 8 bits of resolution by an internal clock. When a match between the up-counter and the TC6DR value is detected, the logic level output from the
PWM6 pin becomes low. The up-counter continues counting. When the up-counter overflow occurs, the PWM6
pin becomes high. The INTTC6 interrupt request is generated at this time. When the timer is stopped, the PWM6 pin is high. Therefore, if the timer is stopped when the PWM6 pin is low, one PMW cycle may be shorter than the programmed value. TC6DR is serially connected to the shift register. If TC6DR is programmed during PWM output, the data set to TC6DR is not shifted until one PWM cycle is completed. Therefore, a pulse can be modulated periodically. For the first time, the data written to TC6DR is shifted when the timer is started by setting TC6CR to 1.
Note 1: The PWM output mode can be used only in the NORMAL1/2 and IDEL 1/2 modes. Note 2: In the PWM output mode, program TC6DR immediately after the INTTC6 interrupt request is generated (typically in the INTTC6 interrupt service routine.) When the programming of TC6DR and the INTTC6 interrupt occur at the same time, an unstable value is shifted, that may result in generation of pulse different from the programmed value until the next INTTC6 interrupt request is issued.
TC6CR
Internal clock
Counter
TC6DR
0
1
n
n+1
FF
0
1
n
n+1
FF
0
1
m
Rewrite
? n m
Rewrite
p
Rewrite Data shift
m
Data shift Shift register
Timer F/F
? n
Data shift
Match detect
Match detect
Match detect
PWM6 pin INTTC6 interrupt request
n
n
m
PWM cycle
Figure 13-3 PWM output Mode Timing Chart (TC6)
Page 133
13. 8-Bit TimerCounter 6 (TC6)
13.1 Configuration TMP86PS64FG
Table 13-3 PWM Mode (Example: fc = 16 MHz)
NORMAL1/2, IDLE1/2 Mode TC6CK DV1CK = 0 Resolution [ns] 000 001 010 011 100 101 110 - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 0 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 - DV1CK = 0 Resolution [ns] - - - 500 250 125 - Cycle [s] - - - 128 64 32 - DV7CK = 1 DV1CK = 1 Resolution [ns] - - - 1000 500 250 - Cycle [s] - - - 256 128 64 -
Page 134
TMP86PS64FG
14. Asynchronous Serial interface (UART )
14.1 Configuration
UART control register 1
UARTCR1
Transmit data buffer
TDBUF
Receive data buffer
RDBUF
3
2
Receive control circuit Transmit control circuit
2
Shift register
Shift register
Parity bit Stop bit
Noise rejection circuit M P X M P X
INTTRX
RXD1 RXD2 TXD1 TXD2
INTTRX
IrDA control
Transmit/receive clock
IRDACR IrDA output control register
Y S fc/13 fc/26 fc/52 fc/104 fc/208 fc/416
INTTC4
fc/96
A B C D E F G H
M P X
A B C S 2
fc/2 7 fc/2 fc/28
6
2 Y Counter
UARTSR
4
UARTCR2
SCISEL UART pin select register MPX: Multiplexer
UART status register Baud rate generator
UART control register 2
Figure 14-1 UART (Asynchronous Serial Interface)
Page 135
14. Asynchronous Serial interface (UART )
14.2 Control TMP86PS64FG
14.2 Control
UART is controlled by the UART Control Registers (UARTCR1, UARTCR2). The operating status can be monitored using the UART status register (UARTSR). TXD1 pin and RXD1 pin can be selected a port assignment by UART Pin Select Register (SCISEL). And Infrared data format (IrDA) output is available by setting IrDA output control register (IRDACR) through TXD1 pin. UART Control Register1
UARTCR1 (001BH) 7 TXE 6 RXE 5 STBT 4 EVEN 3 PE 2 1 BRG 0 (Initial value: 0000 0000)
TXE RXE STBT EVEN PE
Transfer operation Receive operation Transmit stop bit length Even-numbered parity Parity addition
0: 1: 0: 1: 0: 1: 0: 1: 0: 1: 000: 001: 010: 011: 100: 101: 110: 111:
Disable Enable Disable Enable 1 bit 2 bits Odd-numbered parity Even-numbered parity No parity Parity fc/13 [Hz] fc/26 fc/52 fc/104 fc/208 fc/416 TC4 ( Input INTTC4) fc/96 Write only
BRG
Transmit clock select
Note 1: When operations are disabled by setting TXE and RXE bit to "0", the setting becomes valid when data transmit or receive complete. When the transmit data is stored in the transmit data buffer, the data are not transmitted. Even if data transmit is enabled, until new data are written to the transmit data buffer, the current data are not transmitted. Note 2: The transmit clock and the parity are common to transmit and receive. Note 3: UARTCR1 and UARTCR1 should be set to "0" before UARTCR1 is changed.
UART Control Register2
UARTCR2 (001CH) 7 6 5 4 3 2 RXDNC 1 0 STOPBR (Initial value: **** *000)
RXDNC
Selection of RXD input noise rejectio time
00: 01: 10: 11: 0: 1:
No noise rejection (Hysteresis input) Rejects pulses shorter than 31/fc [s] as noise Rejects pulses shorter than 63/fc [s] as noise Rejects pulses shorter than 127/fc [s] as noise 1 bit 2 bits
Write only
STOPBR
Receive stop bit length
Note: When UARTCR2 = "01", pulses longer than 96/fc [s] are always regarded as signals; when UARTCR2 = "10", longer than 192/fc [s]; and when UARTCR2 = "11", longer than 384/fc [s].
Page 136
TMP86PS64FG
UART Status Register
UARTSR (001BH) 7 PERR 6 FERR 5 OERR 4 RBFL 3 TEND 2 TBEP 1 0 (Initial value: 0000 11**)
PERR FERR OERR RBFL TEND TBEP
Parity error flag Framing error flag Overrun error flag Receive data buffer full flag Transmit end flag Transmit data buffer empty flag
0: 1: 0: 1: 0: 1: 0: 1: 0: 1: 0: 1:
No parity error Parity error No framing error Framing error No overrun error Overrun error Receive data buffer empty Receive data buffer full On transmitting Transmit end Transmit data buffer full (Transmit data writing is finished) Transmit data buffer empty
Read only
Note: When an INTTXD is generated, TBEP flag is set to "1" automatically.
UART Receive Data Buffer
RDBUF (001DH) 7 6 5 4 3 2 1 0 Read only (Initial value: 0000 0000)
UART Transmit Data Buffer
TDBUF (001DH) 7 6 5 4 3 2 1 0 Write only (Initial value: 0000 0000)
UART Pin Select Register
SCISEL (002AH) 7 6 5 4 3 2 TXD SEL 1 RXD SEL 0 (Initial value: **** *00*)
TXDESEL RXDSEL
TXD connect pin select RXD connect pin select
0: 1: 0: 1:
P41 P44 P42 P45
R/W
Note 1: Do not change SCISEL register during UART operation. Note 2: Set SCISEL register before performing the setting terminal of a I/O port when changing a terminal.
Page 137
14. Asynchronous Serial interface (UART )
14.3 Transfer Data Format TMP86PS64FG
14.3 Transfer Data Format
In UART, an one-bit start bit (Low level), stop bit (Bit length selectable at high level, by UARTCR1), and parity (Select parity in UARTCR1; even- or odd-numbered parity by UARTCR1) are added to the transfer data. The transfer data formats are shown as follows.
PE
STBT
1
Start
2
Bit 0
3
Bit 1
Frame Length 8
Bit 6
9
Bit 7
10
Stop 1
11
12
0 0 1 1
0 1 0 1
Start
Bit 0
Bit 1
Bit 6
Bit 7
Stop 1
Stop 2
Start
Bit 0
Bit 1
Bit 6
Bit 7
Parity
Stop 1
Start
Bit 0
Bit 1
Bit 6
Bit 7
Parity
Stop 1
Stop 2
Figure 14-2 Transfer Data Format
Without parity / 1 STOP bit
With parity / 1 STOP bit
Without parity / 2 STOP bit
With parity / 2 STOP bit
Figure 14-3 Caution on Changing Transfer Data Format
Note: In order to switch the transfer data format, perform transmit operations in the above Figure 14-3 sequence except for the initial setting.
Page 138
TMP86PS64FG
14.4 Infrared (IrDA) Data Format Transfer Mode
Infrared data format (IrDA) output is available by setting IrDA output control register (IRDACR) through TXD1 pin.
IrDA Output Control Register
IRDACR (001AH) 7 6 5 4 3 2 1 0 IRDA SEL (Initial value: **** ***0)
IRDASEL
IrDA output / UART output select
0: 1:
UART output IrDA output
R/W
Start bit UART output IrDA output D0 D1 D2 D7
Stop bit
3/16 bit width
Figure 14-4 Example of Infrared Data Format (Comparison of Normal output and IrDA output)
Page 139
14. Asynchronous Serial interface (UART )
14.5 Transfer Rate TMP86PS64FG
14.5 Transfer Rate
The baud rate of UART is set of UARTCR1. The example of the baud rate are shown as follows. Table 14-1 Transfer Rate (Example)
Source Clock BRG 16 MHz 000 001 010 011 100 101 76800 [baud] 38400 19200 9600 4800 2400 8 MHz 38400 [baud] 19200 9600 4800 2400 1200 4 MHz 19200 [baud] 9600 4800 2400 1200 600
When TC4 is used as the UART transfer rate (when UARTCR1 = "110"), the transfer clock and transfer rate are determined as follows: Transfer clock [Hz] = TC4 source clock [Hz] / TTREG4 setting value Transfer Rate [baud] = Transfer clock [Hz] / 16
14.6 Data Sampling Method
The UART receiver keeps sampling input using the clock selected by UARTCR1 until a start bit is detected in RXD1 pin input. RT clock starts detecting "L" level of the RXD1 pin. Once a start bit is detected, the start bit, data bits, stop bit(s), and parity bit are sampled at three times of RT7, RT8, and RT9 during one receiver clock interval (RT clock). (RT0 is the position where the bit supposedly starts.) Bit is determined according to majority rule (The data are the same twice or more out of three samplings).
RXD1 pin
Start bit RT0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0
Bit 0 1 2 3 4 5 6 7 8 9 10 11
RT clock
Internal receive data
Start bit (a) Without noise rejection circuit
Bit 0
RXD1 pin
Start bit RT0 1 2 3 4 5 6 7 8
Bit 0 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 10 11
RT clock
Internal receive data
Start bit (b) With noise rejection circuit
Bit 0
Figure 14-5 Data Sampling Method
Page 140
TMP86PS64FG
14.7 STOP Bit Length
Select a transmit stop bit length (1 bit or 2 bits) by UARTCR1.
14.8 Parity
Set parity / no parity by UARTCR1 and set parity type (Odd- or Even-numbered) by UARTCR1.
14.9 Transmit/Receive Operation
14.9.1 Data Transmit Operation
Set UARTCR1 to "1". Read UARTSR to check UARTSR = "1", then write data in TDBUF (Transmit data buffer). Writing data in TDBUF zero-clears UARTSR, transfers the data to the transmit shift register and the data are sequentially output from the TXD1 pin. The data output include a one-bit start bit, stop bits whose number is specified in UARTCR1 and a parity bit if parity addition is specified. Select the data transfer baud rate using UARTCR1. When data transmit starts, transmit buffer empty flag UARTSR is set to "1" and an INTTRX interrupt is generated. While UARTCR1 = "0" and from when "1" is written to UARTCR1 to when send data are written to TDBUF, the TXD1 pin is fixed at high level. When transmitting data, first read UARTSR, then write data in TDBUF. Otherwise, UARTSR is not zero-cleared and transmit does not start.
14.9.2 Data Receive Operation
Set UARTCR1 to "1". When data are received via the RXD1 pin, the receive data are transferred to RDBUF (Receive data buffer). At this time, the data transmitted includes a start bit and stop bit(s) and a parity bit if parity addition is specified. When stop bit(s) are received, data only are extracted and transferred to RDBUF (Receive data buffer). Then the receive buffer full flag UARTSR is set and an INTTRX interrupt is generated. Select the data transfer baud rate using UARTCR1. If an overrun error (OERR) occurs when data are received, the data are not transferred to RDBUF (Receive data buffer) but discarded; data in the RDBUF are not affected.
Note:When a receive operation is disabled by setting UARTCR1 bit to "0", the setting becomes valid when data receive is completed. However, if a framing error occurs in data receive, the receive-disabling setting may not become valid. If a framing error occurs, be sure to perform a re-receive operation.
Page 141
14. Asynchronous Serial interface (UART )
14.10 Status Flag TMP86PS64FG
14.10Status Flag
14.10.1Parity Error
When parity determined using the receive data bits differs from the received parity bit, the parity error flag UARTSR is set to "1". The UARTSR is cleared to "0" when the RDBUF is read after reading the UARTSR.
RXD1 pin
Parity
Stop
Shift register
UARTSR
xxxx0**
pxxxx0*
1pxxxx0
After reading UARTSR then RDBUF clears PERR.
INTTRX interrupt
Figure 14-6 Generation of Parity Error 14.10.2Framing Error
When "0" is sampled as the stop bit in the receive data, framing error flag UARTSR is set to "1". The UARTSR is cleared to "0" when the RDBUF is read after reading the UARTSR.
RXD1 pin
Final bit
Stop
Shift register
UARTSR
xxx0**
xxxx0*
0xxxx0
After reading UARTSR then RDBUF clears FERR.
INTTRX interrupt
Figure 14-7 Generation of Framing Error 14.10.3Overrun Error
When all bits in the next data are received while unread data are still in RDBUF, overrun error flag UARTSR is set to "1". In this case, the receive data is discarded; data in RDBUF are not affected. The UARTSR is cleared to "0" when the RDBUF is read after reading the UARTSR.
Page 142
TMP86PS64FG
UARTSR
RXD1 pin
Final bit
Stop
Shift register
RDBUF
xxx0** yyyy
xxxx0*
1xxxx0
UARTSR
After reading UARTSR then RDBUF clears OERR.
INTTRX interrupt
Figure 14-8 Generation of Overrun Error
Note:Receive operations are disabled until the overrun error flag UARTSR is cleared.
14.10.4Receive Data Buffer Full
Loading the received data in RDBUF sets receive data buffer full flag UARTSR to "1". The UARTSR is cleared to "0" when the RDBUF is read after reading the UARTSR.
RXD1 pin
Final bit
Stop
Shift register
RDBUF
xxx0** yyyy
xxxx0*
1xxxx0
xxxx
After reading UARTSR then RDBUF clears RBFL.
UARTSR
INTTRX interrupt
Figure 14-9 Generation of Receive Data Buffer Full
Note:If the overrun error flag UARTSR is set during the period between reading the UARTSR and reading the RDBUF, it cannot be cleared by only reading the RDBUF. Therefore, after reading the RDBUF, read the UARTSR again to check whether or not the overrun error flag which should have been cleared still remains set.
14.10.5Transmit Data Buffer Empty
When no data is in the transmit buffer TDBUF, UARTSR is set to "1", that is, when data in TDBUF are transferred to the transmit shift register and data transmit starts, transmit data buffer empty flag UARTSR is set to "1". The UARTSR is cleared to "0" when the TDBUF is written after reading the UARTSR.
Page 143
14. Asynchronous Serial interface (UART )
14.10 Status Flag TMP86PS64FG
Data write
TDBUF
Data write
xxxx
yyyy
zzzz
Shift register
TXD1 pin
*****1
1xxxx0
*1xxxx Bit 0
****1x Final bit
*****1 Stop
1yyyy0
Start
UARTSR After reading UARTSR writing TDBUF clears TBEP.
INTTRX interrupt
Figure 14-10 Generation of Transmit Data Buffer Empty 14.10.6Transmit End Flag
When data are transmitted and no data is in TDBUF (UARTSR = "1"), transmit end flag UARTSR is set to "1". The UARTSR is cleared to "0" when the data transmit is stated after writing the TDBUF.
Shift register
TXD1 pin
***1xx
****1x
*****1
1yyyy0
*1yyyy
Stop
Data write for TDBUF
Start
Bit 0
UARTSR
UARTSR
INTTRX interrupt
Figure 14-11 Generation of Transmit End Flag and Transmit Data Buffer Empty
Page 144
TMP86PS64FG
15. Synchronous Serial Interface (SIO1)
The TMP86PS64FG has a clocked-synchronous 8-bit serial interface. Serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transfer up to 64 bits of data. Serial interface is connected to outside peripherl devices via SO1, SI1, SCK1 port.
15.1 Configuration
SIO control / status register
SIO1SR
SIO1CR1
SIO1CR2
CPU
Control circuit
Buffer control circuit Shift register Shift clock
Transmit and receive data buffer (8 bytes in DBR)
7
6
5
4
3
2
1
0
SO1
Serial data output 8-bit transfer 4-bit transfer
SI1
Serial data input
INTSIO1 interrupt request
Serial clock
SCK1
Serial clock I/O
Figure 15-1 Serial Interface
Page 145
15. Synchronous Serial Interface (SIO1)
15.2 Control TMP86PS64FG
15.2 Control
The serial interface is controlled by SIO control registers (SIO1CR1/SIO1CR2). The serial interface status can be determined by reading SIO status register (SIO1SR). The transmit and receive data buffer is controlled by the SIO1CR2. The data buffer is assigned to address 0F90H to 0F97H for SIO in the DBR area, and can continuously transfer up to 8 words (bytes or nibbles) at one time. When the specified number of words has been transferred, a buffer empty (in the transmit mode) or a buffer full (in the receive mode or transmit/receive mode) interrupt (INTSIO1) is generated. When the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock for each word transferred. Four different wait times can be selected with SIO1CR2. SIO Control Register 1
SIO1CR1 (0028H) 7 SIOS 6 SIOINH 5 4 SIOM 3 2 1 SCK 0 (Initial value: 0000 0000)
SIOS
Indicate transfer start / stop
0: 1: 0: 1: 000: 010:
Stop Start Continuously transfer Abort transfer (Automatically cleared after abort) 8-bit transmit mode 4-bit transmit mode 8-bit transmit / receive mode 8-bit receive mode 4-bit receive mode Except the above: Reserved NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV7CK = 1 SLOW1/2 SLEEP1/2 mode fs/25 Write only Write only
SIOINH
Continue / abort transfer
SIOM
Transfer mode select
100: 101: 110:
DV1CK = 0 DV1CK = 1 DV1CK = 1 DV1CK = 1 000 001 SCK Serial clock select 010 011 100 101 110 111 fc/213 fc/28 fc/27 fc/26 fc/25 fc/24 fc/214 fc/29 fc/28 fc/27 fc/26 fc/25 fs/25 fc/28 fc/27 fc/26 fc/25 fc/24 Reserved External clock (Input from SCK1 pin ) fs/25 fc/29 fc/28 fc/27 fc/26 fc/25
Note 1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz] Note 2: Set SIOS to "0" and SIOINH to "1" when setting the transfer mode or serial clock. Note 3: SIO1CR1 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc.
SIO Control Register 2
SIO1CR2 (0029H) 7 6 5 4 WAIT 3 2 1 BUF 0 (Initial value: ***0 0000)
Page 146
TMP86PS64FG
Always sets "00" except 8-bit transmit / receive mode. 00: WAIT Wait control 01: 10: 11: 000: 001: 010: BUF Number of transfer words (Buffer address in use) 011: 100: 101: 110: 111: Tf = TD(Non wait) Tf = 2TD(Wait) Tf = 4TD(Wait) Tf = 8TD (Wait) 1 word transfer 2 words transfer 3 words transfer 4 words transfer 5 words transfer 6 words transfer 7 words transfer 8 words transfer 0F90H 0F90H ~ 0F91H 0F90H ~ 0F92H 0F90H ~ 0F93H 0F90H ~ 0F94H 0F90H ~ 0F95H 0F90H ~ 0F96H 0F90H ~ 0F97H Write only
Note 1: The lower 4 bits of each buffer are used during 4-bit transfers. Zeros (0) are stored to the upper 4bits when receiving. Note 2: Transmitting starts at the lowest address. Received data are also stored starting from the lowest address to the highest address. ( The first buffer address transmitted is 0F90H ). Note 3: The value to be loaded to BUF is held after transfer is completed. Note 4: SIO1CR2 must be set when the serial interface is stopped (SIOF = 0). Note 5: *: Don't care Note 6: SIO1CR2 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc.
SIO Status Register
SIO1SR (0029H) 7 SIOF 6 SEF 5 4 3 2 1 0
SIOF SEF
Serial transfer operating status monitor Shift operating status monitor
0: 1: 0: 1:
Transfer terminated Transfer in process Shift operation terminated Shift operation in process
Read only
Note 1: Tf; Frame time, TD; Data transfer time Note 2: After SIOS is cleared to "0", SIOF is cleared to "0" at the termination of transfer or the setting of SIOINH to "1".
(output)
SCK1 output
TD Tf
Figure 15-2 Frame time (Tf) and Data transfer time (TD)
15.3 Serial clock
15.3.1 Clock source
Internal clock or external clock for the source clock is selected by SIO1CR1.
Page 147
15. Synchronous Serial Interface (SIO1)
15.3 Serial clock TMP86PS64FG
15.3.1.1 Internal clock
Any of six frequencies can be selected. The serial clock is output to the outside on the SCK1 pin. The SCK1 pin goes high when transfer starts. When data writing (in the transmit mode) or reading (in the receive mode or the transmit/receive mode) cannot keep up with the serial clock rate, there is a wait function that automatically stops the serial clock and holds the next shift operation until the read/write processing is completed. Table 15-1 Serial Clock Rate
NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 SCK 000 Clock fc/213 fc/28 fc/27 fc/26 fc/25 fc/24 External Baud Rate 1.91 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps 976.56 Kbps External DV1CK = 1 Clock fc/214 fc/29 fc/28 fc/27 fc/26 fc/25 External Baud Rate 0.95 Kbps 30.52 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps External DV1CK = 0 Clock fs/25 fc/28 fc/27 fc/26 fc/25 fc/24 External Baud Rate 1024 bps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps 976.56 Kbps External DV7CK = 1 DV1CK = 1 Clock fs/25 fc/29 fc/28 fc/27 fc/26 fc/25 External Baud Rate 1024 bps 30.52 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps External Clock fs/25 Baud Rate 1024 bps SLOW1/2, SLEEP1/2 mode
001
010
-
-
011
-
-
100
-
-
101 110 111
External
External
Note: 1 Kbit = 1024 bit (fc = 16 MHz, fs = 32.768 kHz)
Automatically wait function
SCK1
pin (output)
SO1
pin (output) Written transmit data a
a0
a1
a2
a3 b
b0
b1 c
b2
b3
c0
c1
Figure 15-3 Automatic Wait Function (at 4-bit transmit mode)
15.3.1.2 External clock
An external clock connected to the SCK1 pin is used as the serial clock. In this case, output latch of this port should be set to "1". To ensure shifting, a pulse width of at least 4 machine cycles is required. This pulse is needed for the shift operation to execute certainly. Actually, there is necessary processing time for interrupting, writing, and reading. The minimum pulse is determined by setting the mode and the program. Therfore, maximum transfer frequency will be 488.3K bit/sec (at fc=16MHz).
Page 148
TMP86PS64FG
SCK1
pin (Output)
tSCKL tSCKH
tcyc = 4/fc (In the NORMAL1/2, IDLE1/2 modes) 4/fs (In the SLOW1/2, SLEEP1/2 modes) tSCKL, tSCKH > 4tcyc
Figure 15-4 External clock pulse width 15.3.2 Shift edge
The leading edge is used to transmit, and the trailing edge is used to receive.
15.3.2.1 Leading edge
Transmitted data are shifted on the leading edge of the serial clock (falling edge of the SCK1 pin input/ output).
15.3.2.2 Trailing edge
Received data are shifted on the trailing edge of the serial clock (rising edge of the SCK1 pin input/output).
SCK1 pin
SO1 pin
Bit 0
Bit 1
Bit 2
Bit 3
Shift register
3210
*321
**32
***3
(a) Leading edge
SCK1 pin
SI1 pin
Bit 0
Bit 1
Bit 2
Bit 3
Shift register
****
0***
10**
210*
3210
*; Don't care
(b) Trailing edge
Figure 15-5 Shift edge
15.4 Number of bits to transfer
Either 4-bit or 8-bit serial transfer can be selected. When 4-bit serial transfer is selected, only the lower 4 bits of the transmit/receive data buffer register are used. The upper 4 bits are cleared to "0" when receiving. The data is transferred in sequence starting at the least significant bit (LSB).
15.5 Number of words to transfer
Up to 8 words consisting of 4 bits of data (4-bit serial transfer) or 8 bits (8-bit serial transfer) of data can be transferred continuously. The number of words to be transferred can be selected by SIO1CR2. Page 149
15. Synchronous Serial Interface (SIO1)
15.6 Transfer Mode TMP86PS64FG
An INTSIO1 interrupt is generated when the specified number of words has been transferred. If the number of words is to be changed during transfer, the serial interface must be stopped before making the change. The number of words can be changed during automatic-wait operation of an internal clock. In this case, the serial interface is not required to be stopped.
SCK1 pin
SO1 pin
a0
a1
a2
a3
INTSIO1 interrupt
(a) 1 word transmit
SCK1 pin
SO1 pin
a0
a1
a2
a3
b0
b1
b2
b3
c0
c1
c2
c3
INTSIO1 interrupt
(b) 3 words transmit
SCK1 pin
SI1 pin
a0
a1
a2
a3
b0
b1
b2
b3
c0
c1
c2
c3
INTSIO1 interrupt
(c) 3 words receive
Figure 15-6 Number of words to transfer (Example: 1word = 4bit)
15.6 Transfer Mode
SIO1CR1 is used to select the transmit, receive, or transmit/receive mode.
15.6.1 4-bit and 8-bit transfer modes
In these modes, firstly set the SIO control register to the transmit mode, and then write first transmit data (number of transfer words to be transferred) to the data buffer registers (DBR). After the data are written, the transmission is started by setting SIO1CR1 to "1". The data are then output sequentially to the SO pin in synchronous with the serial clock, starting with the least significant bit (LSB). As soon as the LSB has been output, the data are transferred from the data buffer register to the shift register. When the final data bit has been transferred and the data buffer register is empty, an INTSIO1 (Buffer empty) interrupt is generated to request the next transmitted data. When the internal clock is used, the serial clock will stop and an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer register by the time the number of data words specified with the SIO1CR2 has been transmitted. Writing even one word of data cancels the automatic-wait; therefore, when transmitting two or more words, always write the next word before transmission of the previous word is completed.
Note:Automatic waits are also canceled by writing to a DBR not being used as a transmit data buffer register; therefore, during SIO do not use such DBR for other applications. For example, when 3 words are transmitted, do not use the DBR of the remained 5 words.
Page 150
TMP86PS64FG
When an external clock is used, the data must be written to the data buffer register before shifting next data. Thus, the transfer speed is determined by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. The transmission is ended by clearing SIO1CR1 to "0" or setting SIO1CR1 to "1" in buffer empty interrupt service program. SIO1CR1 is cleared, the operation will end after all bits of words are transmitted. That the transmission has ended can be determined from the status of SIO1SR because SIO1SR is cleared to "0" when a transfer is completed. When SIO1CR1 is set, the transmission is immediately ended and SIO1SR is cleared to "0". When an external clock is used, it is also necessary to clear SIO1CR1 to "0" before shifting the next data; If SIO1CR1 is not cleared before shift out, dummy data will be transmitted and the operation will end. If it is necessary to change the number of words, SIO1CR1 should be cleared to "0", then SIO1CR2 must be rewritten after confirming that SIO1SR has been cleared to "0".
Clear SIOS
SIO1CR1
SIO1SR
SIO1SR
SCK1 pin (Output) SO1 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO1 interrupt
DBR
a
Write Write (a) (b)
b
Figure 15-7 Transfer Mode (Example: 8bit, 1word transfer, Internal clock)
Page 151
15. Synchronous Serial Interface (SIO1)
15.6 Transfer Mode TMP86PS64FG
Clear SIOS
SIO1CR1
SIO1SR
SIO1SR
SCK1 pin (Input) SO1 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO1 interrupt
DBR
a
Write Write (a) (b)
b
Figure 15-8 Transfer Mode (Example: 8bit, 1word transfer, External clock)
SCK1 pin
SIO1SR
SO1 pin
MSB of last word
tSODH = min 3.5/fc [s] ( In the NORMAL1/2, IDLE1/2 modes) tSODH = min 3.5/fs [s] (In the SLOW1/2, SLEEP1/2 modes)
Figure 15-9 Transmiiied Data Hold Time at End of Transfer 15.6.2 4-bit and 8-bit receive modes
After setting the control registers to the receive mode, set SIO1CR1 to "1" to enable receiving. The data are then transferred to the shift register via the SI pin in synchronous with the serial clock. When one word of data has been received, it is transferred from the shift register to the data buffer register (DBR). When the number of words specified with the SIO1CR2 has been received, an INTSIO1 (Buffer full) interrupt is generated to request that these data be read out. The data are then read from the data buffer registers by the interrupt service program. When the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial clock will stop and an automatic-wait will be initiated until the data are read. A wait will not be initiated if even one data word has been read.
Note:Waits are also canceled by reading a DBR not being used as a received data buffer register is read; therefore, during SIO1 do not use such DBR for other applications.
Page 152
TMP86PS64FG
When an external clock is used, the shift operation is synchronized with the external clock; therefore, the previous data are read before the next data are transferred to the data buffer register. If the previous data have not been read, the next data will not be transferred to the data buffer register and the receiving of any more data will be canceled. When an external clock is used, the maximum transfer speed is determined by the delay between the time when the interrupt request is generated and when the data received have been read. The receiving is ended by clearing SIO1CR1 to "0" or setting SIO1CR1 to "1" in buffer full interrupt service program. When SIO1CR1 is cleared, the current data are transferred to the buffer. After SIO1CR1 cleared, the receiving is ended at the time that the final bit of the data has been received. That the receiving has ended can be determined from the status of SIO1SR. SIO1SR is cleared to "0" when the receiving is ended. After confirmed the receiving termination, the final receiving data is read. When SIO1CR1 is set, the receiving is immediately ended and SIO1SR is cleared to "0". (The received data is ignored, and it is not required to be read out.) If it is necessary to change the number of words in external clock operation, SIO1CR1 should be cleared to "0" then SIO1CR2 must be rewritten after confirming that SIO1SR has been cleared to "0". If it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of data receiving, SIO1CR2 must be rewritten before the received data is read out.
Note:The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIO1CR1 to "0", read the last data and then switch the transfer mode.
Clear SIOS
SIO1CR1
SIO1SR
SIO1SR
SCK1 pin (Output) SI1 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO1 Interrupt
DBR
a
Read out
b
Read out
Figure 15-10 Receive Mode (Example: 8bit, 1word transfer, Internal clock) 15.6.3 8-bit transfer / receive mode
After setting the SIO control register to the 8-bit transmit/receive mode, write the data to be transmitted first to the data buffer registers (DBR). After that, enable the transmit/receive by setting SIO1CR1 to "1". When transmitting, the data are output from the SO1 pin at leading edges of the serial clock. When receiving, the data are input to the SI1 pin at the trailing edges of the serial clock. When the all receive is enabled, 8-bit data are transferred from the shift register to the data buffer register. An INTSIO1 interrupt is generated when the number of data words specified with the SIO1CR2 has been transferred. Usually, read the receive data from the buffer register in the interrupt service. The data buffer register is used for both transmitting and receiving; therefore, always write the data to be transmitted after reading the all received data. When the internal clock is used, a wait is initiated until the received data are read and the next transfer data are written. A wait will not be initiated if even one transfer data word has been written. Page 153
15. Synchronous Serial Interface (SIO1)
15.6 Transfer Mode TMP86PS64FG
When an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift operation. When an external clock is used, the transfer speed is determined by the maximum delay between generation of an interrupt request and the received data are read and the data to be transmitted next are written. The transmit/receive operation is ended by clearing SIO1CR1 to "0" or setting SIO1CR1 to "1" in INTSIO1 interrupt service program. When SIO1CR1 is cleared, the current data are transferred to the buffer. After SIO1CR1 cleared, the transmitting/receiving is ended at the time that the final bit of the data has been transmitted. That the transmitting/receiving has ended can be determined from the status of SIO1SR. SIO1SR is cleared to "0" when the transmitting/receiving is ended. When SIO1CR1 is set, the transmit/receive operation is immediately ended and SIO1SR is cleared to "0". If it is necessary to change the number of words in external clock operation, SIO1CR1 should be cleared to "0", then SIO1CR2 must be rewritten after confirming that SIO1SR has been cleared to "0". If it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of transmit/receive operation, SIO1CR2 must be rewritten before reading and writing of the receive/transmit data.
Note:The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIO1CR1 to "0", read the last data and then switch the transfer mode.
Clear SIOS
SIO1CR1
SIO1SR
SIO1SR
SCK1 pin (output) SO1 pin
a0 c0
a1 c1
a2 c2
a3 c3
a4 c4
a5 c5
a6 c6
a7 c7
b0 d0
b1 d1
b2 d2
b3 d3
b4 d4
b5 d5
b6 d6
b7 d7
SI1 pin
INTSIO1 interrupt
DBR
a
Write (a) Read out (c)
c
b
Write (b)
d
Read out (d)
Figure 15-11 Transfer / Receive Mode (Example: 8bit, 1word transfer, Internal clock)
Page 154
TMP86PS64FG
SCK1 pin
SIO1SR
SO1 pin
Bit 6
Bit 7 of last word
tSODH = min 4/fc [s] ( In the NORMAL1/2, IDLE1/2 modes) tSODH = min 4/fs [s] (In the SLOW1/2, SLEEP1/2 modes)
Figure 15-12 Transmitted Data Hold Time at End of Transfer / Receive
Page 155
15. Synchronous Serial Interface (SIO1)
15.6 Transfer Mode TMP86PS64FG
Page 156
TMP86PS64FG
16. Synchronous Serial Interface (SIO2)
The TMP86PS64FG has a clocked-synchronous 8-bit serial interface. Serial interface has an 8-byte transmit and receive data buffer that can automatically and continuously transfer up to 64 bits of data. Serial interface is connected to outside peripherl devices via SO2, SI2, SCK2 port.
16.1 Configuration
SIO control / status register
SIO2SR
SIO2CR1
SIO2CR2
CPU
Control circuit
Buffer control circuit Shift register Shift clock
Transmit and receive data buffer (8 bytes in DBR)
7
6
5
4
3
2
1
0
SO2
Serial data output 8-bit transfer 4-bit transfer
SI2
Serial data input
INTSIO2 interrupt request
Serial clock
SCK2
Serial clock I/O
Figure 16-1 Serial Interface
Page 157
16. Synchronous Serial Interface (SIO2)
16.2 Control TMP86PS64FG
16.2 Control
The serial interface is controlled by SIO control registers (SIO2CR1/SIO2CR2). The serial interface status can be determined by reading SIO status register (SIO2SR). The transmit and receive data buffer is controlled by the SIO2CR2. The data buffer is assigned to address 0F98H to 0F9FH for SIO in the DBR area, and can continuously transfer up to 8 words (bytes or nibbles) at one time. When the specified number of words has been transferred, a buffer empty (in the transmit mode) or a buffer full (in the receive mode or transmit/receive mode) interrupt (INTSIO2) is generated. When the internal clock is used as the serial clock in the 8-bit receive mode and the 8-bit transmit/receive mode, a fixed interval wait can be applied to the serial clock for each word transferred. Four different wait times can be selected with SIO2CR2. SIO Control Register 1
SIO2CR1 (0FB4H) 7 SIOS 6 SIOINH 5 4 SIOM 3 2 1 SCK 0 (Initial value: 0000 0000)
SIOS
Indicate transfer start / stop
0: 1: 0: 1: 000: 010:
Stop Start Continuously transfer Abort transfer (Automatically cleared after abort) 8-bit transmit mode 4-bit transmit mode 8-bit transmit / receive mode 8-bit receive mode 4-bit receive mode Except the above: Reserved NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV7CK = 1 SLOW1/2 SLEEP1/2 mode fs/27 Write only Write only
SIOINH
Continue / abort transfer
SIOM
Transfer mode select
100: 101: 110:
DV1CK = 0 DV1CK = 1 DV1CK = 1 DV1CK = 1 000 001 SCK Serial clock select 010 011 100 101 110 111 fc/215 fc/28 fc/27 fc/26 fc/25 fc/24 fc/216 fc/29 fc/28 fc/27 fc/26 fc/25 fs/27 fc/28 fc/27 fc/26 fc/25 fc/24 Reserved External clock (Input from SCK2 pin ) fs/27 fc/29 fc/28 fc/27 fc/26 fc/25
Note 1: fc; High-frequency clock [Hz], fs; Low-frequency clock [Hz] Note 2: Set SIOS to "0" and SIOINH to "1" when setting the transfer mode or serial clock. Note 3: SIO2CR1 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc.
SIO Control Register 2
SIO2CR2 (0FB5H) 7 6 5 4 WAIT 3 2 1 BUF 0 (Initial value: ***0 0000)
Page 158
TMP86PS64FG
Always sets "00" except 8-bit transmit / receive mode. 00: WAIT Wait control 01: 10: 11: 000: 001: 010: BUF Number of transfer words (Buffer address in use) 011: 100: 101: 110: 111: Tf = TD(Non wait) Tf = 2TD(Wait) Tf = 4TD(Wait) Tf = 8TD (Wait) 1 word transfer 2 words transfer 3 words transfer 4 words transfer 5 words transfer 6 words transfer 7 words transfer 8 words transfer 0F98H 0F98H ~ 0F99H 0F98H ~ 0F9AH 0F98H ~ 0F9BH 0F98H ~ 0F9CH 0F98H ~ 0F9DH 0F98H ~ 0F9EH 0F98H ~ 0F9FH Write only
Note 1: The lower 4 bits of each buffer are used during 4-bit transfers. Zeros (0) are stored to the upper 4bits when receiving. Note 2: Transmitting starts at the lowest address. Received data are also stored starting from the lowest address to the highest address. ( The first buffer address transmitted is 0F98H ). Note 3: The value to be loaded to BUF is held after transfer is completed. Note 4: SIO2CR2 must be set when the serial interface is stopped (SIOF = 0). Note 5: *: Don't care Note 6: SIO2CR2 is write-only register, which cannot access any of in read-modify-write instruction such as bit operate, etc.
SIO Status Register
SIO2SR (0FB5H) 7 SIOF 6 SEF 5 4 3 2 1 0
SIOF SEF
Serial transfer operating status monitor Shift operating status monitor
0: 1: 0: 1:
Transfer terminated Transfer in process Shift operation terminated Shift operation in process
Read only
Note 1: Tf; Frame time, TD; Data transfer time Note 2: After SIOS is cleared to "0", SIOF is cleared to "0" at the termination of transfer or the setting of SIOINH to "1".
(output)
SCK2 output
TD Tf
Figure 16-2 Frame time (Tf) and Data transfer time (TD)
16.3 Serial clock
16.3.1 Clock source
Internal clock or external clock for the source clock is selected by SIO2CR1.
Page 159
16. Synchronous Serial Interface (SIO2)
16.3 Serial clock TMP86PS64FG
16.3.1.1 Internal clock
Any of six frequencies can be selected. The serial clock is output to the outside on the SCK2 pin. The SCK2 pin goes high when transfer starts. When data writing (in the transmit mode) or reading (in the receive mode or the transmit/receive mode) cannot keep up with the serial clock rate, there is a wait function that automatically stops the serial clock and holds the next shift operation until the read/write processing is completed. Table 16-1 Serial Clock Rate
NORMAL1/2, IDLE1/2 mode DV7CK = 0 DV1CK = 0 SCK 000 Clock fc/215 fc/28 fc/27 fc/26 fc/25 fc/24 External Baud Rate 0.48 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps 976.56 Kbps External DV1CK = 1 Clock fc/216 fc/29 fc/28 fc/27 fc/26 fc/25 External Baud Rate 0.24 Kbps 30.52 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps External DV1CK = 0 Clock fs/27 fc/28 fc/27 fc/26 fc/25 fc/24 External Baud Rate 256 bps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps 976.56 Kbps External DV7CK = 1 DV1CK = 1 Clock fs/27 fc/29 fc/28 fc/27 fc/26 fc/25 External Baud Rate 256 bps 30.52 Kbps 61.04 Kbps 122.07 Kbps 244.14 Kbps 488.28 Kbps External Clock fs/27 Baud Rate 256 bps SLOW1/2, SLEEP1/2 mode
001
010
-
-
011
-
-
100
-
-
101 110 111
External
External
Note: 1 Kbit = 1024 bit (fc = 16 MHz, fs = 32.768 kHz)
Automatically wait function
SCK2
pin (output)
SO2
pin (output) Written transmit data a
a0
a1
a2
a3 b
b0
b1 c
b2
b3
c0
c1
Figure 16-3 Automatic Wait Function (at 4-bit transmit mode)
16.3.1.2 External clock
An external clock connected to the SCK2 pin is used as the serial clock. In this case, output latch of this port should be set to "1". To ensure shifting, a pulse width of at least 4 machine cycles is required. This pulse is needed for the shift operation to execute certainly. Actually, there is necessary processing time for interrupting, writing, and reading. The minimum pulse is determined by setting the mode and the program. Therfore, maximum transfer frequency will be 488.3K bit/sec (at fc=16MHz).
Page 160
TMP86PS64FG
SCK2
pin (Output)
tSCKL tSCKH
tcyc = 4/fc (In the NORMAL1/2, IDLE1/2 modes) 4/fs (In the SLOW1/2, SLEEP1/2 modes) tSCKL, tSCKH > 4tcyc
Figure 16-4 External clock pulse width 16.3.2 Shift edge
The leading edge is used to transmit, and the trailing edge is used to receive.
16.3.2.1 Leading edge
Transmitted data are shifted on the leading edge of the serial clock (falling edge of the SCK2 pin input/ output).
16.3.2.2 Trailing edge
Received data are shifted on the trailing edge of the serial clock (rising edge of the SCK2 pin input/output).
SCK2 pin
SO2 pin
Bit 0
Bit 1
Bit 2
Bit 3
Shift register
3210
*321
**32
***3
(a) Leading edge
SCK2 pin
SI2 pin
Bit 0
Bit 1
Bit 2
Bit 3
Shift register
****
0***
10**
210*
3210
*; Don't care
(b) Trailing edge
Figure 16-5 Shift edge
16.4 Number of bits to transfer
Either 4-bit or 8-bit serial transfer can be selected. When 4-bit serial transfer is selected, only the lower 4 bits of the transmit/receive data buffer register are used. The upper 4 bits are cleared to "0" when receiving. The data is transferred in sequence starting at the least significant bit (LSB).
16.5 Number of words to transfer
Up to 8 words consisting of 4 bits of data (4-bit serial transfer) or 8 bits (8-bit serial transfer) of data can be transferred continuously. The number of words to be transferred can be selected by SIO2CR2. Page 161
16. Synchronous Serial Interface (SIO2)
16.6 Transfer Mode TMP86PS64FG
An INTSIO2 interrupt is generated when the specified number of words has been transferred. If the number of words is to be changed during transfer, the serial interface must be stopped before making the change. The number of words can be changed during automatic-wait operation of an internal clock. In this case, the serial interface is not required to be stopped.
SCK2 pin
SO2 pin
a0
a1
a2
a3
INTSIO2 interrupt
(a) 1 word transmit
SCK2 pin
SO2 pin
a0
a1
a2
a3
b0
b1
b2
b3
c0
c1
c2
c3
INTSIO2 interrupt
(b) 3 words transmit
SCK2 pin
SI2 pin
a0
a1
a2
a3
b0
b1
b2
b3
c0
c1
c2
c3
INTSIO2 interrupt
(c) 3 words receive
Figure 16-6 Number of words to transfer (Example: 1word = 4bit)
16.6 Transfer Mode
SIO2CR1 is used to select the transmit, receive, or transmit/receive mode.
16.6.1 4-bit and 8-bit transfer modes
In these modes, firstly set the SIO control register to the transmit mode, and then write first transmit data (number of transfer words to be transferred) to the data buffer registers (DBR). After the data are written, the transmission is started by setting SIO2CR1 to "1". The data are then output sequentially to the SO pin in synchronous with the serial clock, starting with the least significant bit (LSB). As soon as the LSB has been output, the data are transferred from the data buffer register to the shift register. When the final data bit has been transferred and the data buffer register is empty, an INTSIO2 (Buffer empty) interrupt is generated to request the next transmitted data. When the internal clock is used, the serial clock will stop and an automatic-wait will be initiated if the next transmitted data are not loaded to the data buffer register by the time the number of data words specified with the SIO2CR2 has been transmitted. Writing even one word of data cancels the automatic-wait; therefore, when transmitting two or more words, always write the next word before transmission of the previous word is completed.
Note:Automatic waits are also canceled by writing to a DBR not being used as a transmit data buffer register; therefore, during SIO do not use such DBR for other applications. For example, when 3 words are transmitted, do not use the DBR of the remained 5 words.
Page 162
TMP86PS64FG
When an external clock is used, the data must be written to the data buffer register before shifting next data. Thus, the transfer speed is determined by the maximum delay time from the generation of the interrupt request to writing of the data to the data buffer register by the interrupt service program. The transmission is ended by clearing SIO2CR1 to "0" or setting SIO2CR1 to "1" in buffer empty interrupt service program. SIO2CR1 is cleared, the operation will end after all bits of words are transmitted. That the transmission has ended can be determined from the status of SIO2SR because SIO2SR is cleared to "0" when a transfer is completed. When SIO2CR1 is set, the transmission is immediately ended and SIO2SR is cleared to "0". When an external clock is used, it is also necessary to clear SIO2CR1 to "0" before shifting the next data; If SIO2CR1 is not cleared before shift out, dummy data will be transmitted and the operation will end. If it is necessary to change the number of words, SIO2CR1 should be cleared to "0", then SIO2CR2 must be rewritten after confirming that SIO2SR has been cleared to "0".
Clear SIOS
SIO2CR1
SIO2SR
SIO2SR
SCK2 pin (Output) SO2 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO2 interrupt
DBR
a
Write Write (a) (b)
b
Figure 16-7 Transfer Mode (Example: 8bit, 1word transfer, Internal clock)
Page 163
16. Synchronous Serial Interface (SIO2)
16.6 Transfer Mode TMP86PS64FG
Clear SIOS
SIO2CR1
SIO2SR
SIO2SR
SCK2 pin (Input) SO2 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO2 interrupt
DBR
a
Write Write (a) (b)
b
Figure 16-8 Transfer Mode (Example: 8bit, 1word transfer, External clock)
SCK2 pin
SIO2SR
SO2 pin
MSB of last word
tSODH = min 3.5/fc [s] ( In the NORMAL1/2, IDLE1/2 modes) tSODH = min 3.5/fs [s] (In the SLOW1/2, SLEEP1/2 modes)
Figure 16-9 Transmiiied Data Hold Time at End of Transfer 16.6.2 4-bit and 8-bit receive modes
After setting the control registers to the receive mode, set SIO2CR1 to "1" to enable receiving. The data are then transferred to the shift register via the SI pin in synchronous with the serial clock. When one word of data has been received, it is transferred from the shift register to the data buffer register (DBR). When the number of words specified with the SIO2CR2 has been received, an INTSIO2 (Buffer full) interrupt is generated to request that these data be read out. The data are then read from the data buffer registers by the interrupt service program. When the internal clock is used, and the previous data are not read from the data buffer register before the next data are received, the serial clock will stop and an automatic-wait will be initiated until the data are read. A wait will not be initiated if even one data word has been read.
Note:Waits are also canceled by reading a DBR not being used as a received data buffer register is read; therefore, during SIO2 do not use such DBR for other applications.
Page 164
TMP86PS64FG
When an external clock is used, the shift operation is synchronized with the external clock; therefore, the previous data are read before the next data are transferred to the data buffer register. If the previous data have not been read, the next data will not be transferred to the data buffer register and the receiving of any more data will be canceled. When an external clock is used, the maximum transfer speed is determined by the delay between the time when the interrupt request is generated and when the data received have been read. The receiving is ended by clearing SIO2CR1 to "0" or setting SIO2CR1 to "1" in buffer full interrupt service program. When SIO2CR1 is cleared, the current data are transferred to the buffer. After SIO2CR1 cleared, the receiving is ended at the time that the final bit of the data has been received. That the receiving has ended can be determined from the status of SIO2SR. SIO2SR is cleared to "0" when the receiving is ended. After confirmed the receiving termination, the final receiving data is read. When SIO2CR1 is set, the receiving is immediately ended and SIO2SR is cleared to "0". (The received data is ignored, and it is not required to be read out.) If it is necessary to change the number of words in external clock operation, SIO2CR1 should be cleared to "0" then SIO2CR2 must be rewritten after confirming that SIO2SR has been cleared to "0". If it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of data receiving, SIO2CR2 must be rewritten before the received data is read out.
Note:The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIO2CR1 to "0", read the last data and then switch the transfer mode.
Clear SIOS
SIO2CR1
SIO2SR
SIO2SR
SCK2 pin (Output) SI2 pin
a0
a1
a2
a3
a4
a5
a6
a7
b0
b1
b2
b3
b4
b5
b6
b7
INTSIO2 Interrupt
DBR
a
Read out
b
Read out
Figure 16-10 Receive Mode (Example: 8bit, 1word transfer, Internal clock) 16.6.3 8-bit transfer / receive mode
After setting the SIO control register to the 8-bit transmit/receive mode, write the data to be transmitted first to the data buffer registers (DBR). After that, enable the transmit/receive by setting SIO2CR1 to "1". When transmitting, the data are output from the SO2 pin at leading edges of the serial clock. When receiving, the data are input to the SI2 pin at the trailing edges of the serial clock. When the all receive is enabled, 8-bit data are transferred from the shift register to the data buffer register. An INTSIO2 interrupt is generated when the number of data words specified with the SIO2CR2 has been transferred. Usually, read the receive data from the buffer register in the interrupt service. The data buffer register is used for both transmitting and receiving; therefore, always write the data to be transmitted after reading the all received data. When the internal clock is used, a wait is initiated until the received data are read and the next transfer data are written. A wait will not be initiated if even one transfer data word has been written. Page 165
16. Synchronous Serial Interface (SIO2)
16.6 Transfer Mode TMP86PS64FG
When an external clock is used, the shift operation is synchronized with the external clock; therefore, it is necessary to read the received data and write the data to be transmitted next before starting the next shift operation. When an external clock is used, the transfer speed is determined by the maximum delay between generation of an interrupt request and the received data are read and the data to be transmitted next are written. The transmit/receive operation is ended by clearing SIO2CR1 to "0" or setting SIO2CR1 to "1" in INTSIO2 interrupt service program. When SIO2CR1 is cleared, the current data are transferred to the buffer. After SIO2CR1 cleared, the transmitting/receiving is ended at the time that the final bit of the data has been transmitted. That the transmitting/receiving has ended can be determined from the status of SIO2SR. SIO2SR is cleared to "0" when the transmitting/receiving is ended. When SIO2CR1 is set, the transmit/receive operation is immediately ended and SIO2SR is cleared to "0". If it is necessary to change the number of words in external clock operation, SIO2CR1 should be cleared to "0", then SIO2CR2 must be rewritten after confirming that SIO2SR has been cleared to "0". If it is necessary to change the number of words in internal clock, during automatic-wait operation which occurs after completion of transmit/receive operation, SIO2CR2 must be rewritten before reading and writing of the receive/transmit data.
Note:The buffer contents are lost when the transfer mode is switched. If it should become necessary to switch the transfer mode, end receiving by clearing SIO2CR1 to "0", read the last data and then switch the transfer mode.
Clear SIOS
SIO2CR1
SIO2SR
SIO2SR
SCK2 pin (output) SO2 pin
a0 c0
a1 c1
a2 c2
a3 c3
a4 c4
a5 c5
a6 c6
a7 c7
b0 d0
b1 d1
b2 d2
b3 d3
b4 d4
b5 d5
b6 d6
b7 d7
SI2 pin
INTSIO2 interrupt
DBR
a
Write (a) Read out (c)
c
b
Write (b)
d
Read out (d)
Figure 16-11 Transfer / Receive Mode (Example: 8bit, 1word transfer, Internal clock)
Page 166
TMP86PS64FG
SCK2 pin
SIO2SR
SO2 pin
Bit 6
Bit 7 of last word
tSODH = min 4/fc [s] ( In the NORMAL1/2, IDLE1/2 modes) tSODH = min 4/fs [s] (In the SLOW1/2, SLEEP1/2 modes)
Figure 16-12 Transmitted Data Hold Time at End of Transfer / Receive
Page 167
16. Synchronous Serial Interface (SIO2)
16.6 Transfer Mode TMP86PS64FG
Page 168
TMP86PS64FG
17. 10-bit AD Converter (ADC)
The TMP86PS64FG have a 10-bit successive approximation type AD converter.
17.1 Configuration
The circuit configuration of the 10-bit AD converter is shown in Figure 17-1. It consists of control register ADCCR1 and ADCCR2, converted value register ADCDR1 and ADCDR2, a DA converter, a sample-hold circuit, a comparator, and a successive comparison circuit.
DA converter
VAREF AVSS
R/2
AVDD
R Reference voltage
R/2
Analog input multiplexer
AIN0
Sample hold circuit
A
Y 10 Analog comparator
AIN15
n S EN IREFON 4 SAIN ADRS AINDS
Successive approximate circuit Shift clock Control circuit 2 AMD 3 ACK ADCCR2 8 ADCDR1 2 INTADC
EOCF ADBF
ADCCR1
ADCDR2
AD converter control register 1, 2
AD conversion result register 1, 2
Note: Before using AD converter, set appropriate value to I/O port register conbining a analog input port. For details, see the section on "I/O ports".
Figure 17-1 10-bit AD Converter
Page 169
17. 10-bit AD Converter (ADC)
17.2 Register configuration TMP86PS64FG
17.2 Register configuration
The AD converter consists of the following four registers: 1. AD converter control register 1 (ADCCR1) This register selects the analog channels and operation mode (Software start or repeat) in which to perform AD conversion and controls the AD converter as it starts operating. 2. AD converter control register 2 (ADCCR2) This register selects the AD conversion time and controls the connection of the DA converter (Ladder resistor network). 3. AD converted value register 1 (ADCDR1) This register used to store the digital value fter being converted by the AD converter. 4. AD converted value register 2 (ADCDR2) This register monitors the operating status of the AD converter. AD Converter Control Register 1
ADCCR1 (000EH) 7 ADRS 6 AMD 5 4 AINDS 3 2 SAIN 1 0 (Initial value: 0001 0000)
ADRS
AD conversion start
0: 1: 00: 01: 10: 11: 0: 1: 0000: 0001: 0010: 0011: 0100: 0101: 0110: 0111: 1000: 1001: 1010: 1011: 1100: 1101: 1110: 1111:
AD conversion start AD operation disable Software start mode Reserved Repeat mode Analog input enable Analog input disable AIN0 AIN1 AIN2 AIN3 AIN4 AIN5 AIN6 AIN7 AIN8 AIN9 AIN10 AIN11 AIN12 AIN13 AIN14 AIN15
AMD
AD operating mode
AINDS
Analog input control
R/W
SAIN
Analog input channel select
Note 1: Select analog input channel during AD converter stops (ADCDR2 = "0"). Note 2: When the analog input channel is all use disabling, the ADCCR1 should be set to "1". Note 3: During conversion, Do not perform port output instruction to maintain a precision for all of the pins because analog input port use as general input port. And for port near to analog input, Do not input intense signaling of change. Note 4: The ADCCR1 is automatically cleared to "0" after starting conversion. Note 5: Do not set ADCCR1 newly again during AD conversion. Before setting ADCCR1 newly again, check ADCDR2 to see that the conversion is completed or wait until the interrupt signal (INTADC) is generated (e.g., interrupt handling routine). Note 6: After STOP or SLOW/SLEEP mode are started, AD converter control register1 (ADCCR1) is all initialized and no data can be written in this register. Therfore, to use AD converter again, set the ADCCR1 newly after returning to NORMAL1 or NORMAL2 mode.
Page 170
TMP86PS64FG
AD Converter Control Register 2
ADCCR2 (000FH) 7 6 5 IREFON 4 "1" 3 2 ACK 1 0 "0" (Initial value: **0* 000*)
IREFON
DA converter (Ladder resistor) connection control
0: 1: 000: 001: 010: 011: 100: 101: 110: 111:
Connected only during AD conversion Always connected 39/fc Reserved 78/fc 156/fc 312/fc 624/fc 1248/fc Reserved
ACK
AD conversion time select (Refer to the following table about the conversion time)
R/W
Note 1: Always set bit0 in ADCCR2 to "0" and set bit4 in ADCCR2 to "1". Note 2: When a read instruction for ADCCR2, bit6 to 7 in ADCCR2 read in as undefined data. Note 3: After STOP or SLOW/SLEEP mode are started, AD converter control register2 (ADCCR2) is all initialized and no data can be written in this register. Therfore, to use AD converter again, set the ADCCR2 newly after returning to NORMAL1 or NORMAL2 mode.
Table 17-1 ACK setting and Conversion time (at CGCR="0")
Condition ACK 000 001 010 011 100 101 110 111 78/fc 156/fc 312/fc 624/fc 1248/fc 19.5 s 39.0 s 78.0 s 19.5 s 39.0 s 78.0 s 156.0 s Conversion time 39/fc 16 MHz 8 MHz 4 MHz 2 MHz 19.5 s Reserved 19.5 s 39.0 s 78.0 s 156.0 s Reserved 39.0 s 78.0 s 156.0 s 15.6 s 31.2 s 62.4 s 124.8 s 15.6 s 31.2 s 62.4 s 124.8 s 31.2 s 62.4 s 124.8 s 10 MHz 5 MHz 2.5 MHz 15.6 s
Table 17-2 ACK setting and Conversion time (at CGCR="1")
Condition ACK 000 001 010 011 100 101 110 111 156/fc 312/fc 624/fc 1248/fc 2096/fc 19.5 s 39.0 s 78.0 s 156.0 s 19.5 s 39.0 s 78.0 s 156.0 s Conversion time 39/fc 16 MHz 8 MHz 4 MHz 2 MHz 19.5 s Reserved 39.0 s 78.0 s 156.0 s Reserved 78.0 s 156.0 s 15.6 s 31.2 s 62.4 s 124.8 s 31.2 s 62.4 s 124.8 s 62.4 s 124.8 s 10 MHz 5 MHz 2.5 MHz 15.6 s
Note 1: Setting for "-" in the above table are inhibited.
fc: High Frequency oscillation clock [Hz]
Note 2: Set conversion time setting should be kept more than the following time by Analog reference voltage (VAREF) .
VAREF = 4.5 to 5.5 V VAREF = 2.7 to 5.5 V 15.6 s and more 31.2 s and more
Page 171
17. 10-bit AD Converter (ADC)
17.2 Register configuration TMP86PS64FG
AD Converted value Register 1
ADCDR1 (0027H) 7 AD09 6 AD08 5 AD07 4 AD06 3 AD05 2 AD04 1 AD03 0 AD02 (Initial value: 0000 0000)
AD Converted value Register 2
ADCDR2 (0026H) 7 AD01 6 AD00 5 EOCF 4 ADBF 3 2 1 0 (Initial value: 0000 ****)
EOCF ADBF
AD conversion end flag AD conversion BUSY flag
0: 1: 0: 1:
Before or during conversion Conversion completed During stop of AD conversion During AD conversion
Read only
Note 1: The ADCDR2 is cleared to "0" when reading the ADCDR1. Therfore, the AD conversion result should be read to ADCDR2 more first than ADCDR1. Note 2: The ADCDR2 is set to "1" when AD conversion starts, and cleared to "0" when AD conversion finished. It also is cleared upon entering STOP mode or SLOW mode . Note 3: If a read instruction is executed for ADCDR2, read data of bit3 to bit0 are unstable.
Page 172
TMP86PS64FG
17.3 Function
17.3.1 Software Start Mode
After setting ADCCR1 to "01" (software start mode), set ADCCR1 to "1". AD conversion of the voltage at the analog input pin specified by ADCCR1 is thereby started. After completion of the AD conversion, the conversion result is stored in AD converted value registers (ADCDR1, ADCDR2) and at the same time ADCDR2 is set to 1, the AD conversion finished interrupt (INTADC) is generated. ADRS is automatically cleared after AD conversion has started. Do not set ADCCR1 newly again (Restart) during AD conversion. Before setting ADRS newly again, check ADCDR2 to see that the conversion is completed or wait until the interrupt signal (INTADC) is generated (e.g., interrupt handling routine).
AD conversion start ADCCR1 AD conversion start
ADCDR2
ADCDR1 status
Indeterminate
1st conversion result
2nd conversion result EOCF cleared by reading conversion result
ADCDR2
INTADC interrupt request ADCDR1 Conversion result read Conversion result read Conversion result read Conversion result read
ADCDR2
Figure 17-2 Software Start Mode 17.3.2 Repeat Mode
AD conversion of the voltage at the analog input pin specified by ADCCR1 is performed repeatedly. In this mode, AD conversion is started by setting ADCCR1 to "1" after setting ADCCR1 to "11" (Repeat mode). After completion of the AD conversion, the conversion result is stored in AD converted value registers (ADCDR1, ADCDR2) and at the same time ADCDR2 is set to 1, the AD conversion finished interrupt (INTADC) is generated. In repeat mode, each time one AD conversion is completed, the next AD conversion is started. To stop AD conversion, set ADCCR1 to "00" (Disable mode) by writing 0s. The AD convert operation is stopped immediately. The converted value at this time is not stored in the AD converted value register.
Page 173
17. 10-bit AD Converter (ADC)
17.3 Function TMP86PS64FG
ADCCR1 AD conversion start ADCCR1
"11"
"00"
Conversion operation
1st conversion result
2nd conversion result
3rd conversion result
AD convert operation suspended. Conversion result is not stored.
3rd conversion result
ADCDR1,ADCDR2
Indeterminate
1st conversion result
2nd conversion result
ADCDR2 EOCF cleared by reading conversion result
INTADC interrupt request ADCDR1 ADCDR2 Conversion result read Conversion result read Conversion result read Conversion result read
Conversion result read Conversion result read
Figure 17-3 Repeat Mode 17.3.3 Register Setting
1. Set up the AD converter control register 1 (ADCCR1) as follows: * Choose the channel to AD convert using AD input channel select (SAIN). * Specify analog input enable for analog input control (AINDS). * Specify AMD for the AD converter control operation mode (software or repeat mode). 2. Set up the AD converter control register 2 (ADCCR2) as follows: * Set the AD conversion time using AD conversion time (ACK). For details on how to set the conversion time, refer to Figure 17-1, Figure 17-2 and AD converter control register 2. * Choose IREFON for DA converter control. 3. After setting up (1) and (2) above, set AD conversion start (ADRS) of AD converter control register 1 (ADCCR1) to "1". If software start mode has been selected, AD conversion starts immediately. 4. After an elapse of the specified AD conversion time, the AD converted value is stored in AD converted value register 1 (ADCDR1) and the AD conversion finished flag (EOCF) of AD converted value register 2 (ADCDR2) is set to "1", upon which time AD conversion interrupt INTADC is generated. 5. EOCF is cleared to "0" by a read of the conversion result. However, if reconverted before a register read, although EOCF is cleared the previous conversion result is retained until the next conversion is completed.
Page 174
TMP86PS64FG
Example :After selecting the conversion time 19.5 s at 16 MHz and the analog input channel AIN3 pin, perform AD conversion once. After checking EOCF, read the converted value, store the lower 2 bits in address 0009EH nd store the upper 8 bits in address 0009FH in RAM. The operation mode is software start mode.
: (port setting) : LD LD : : (ADCCR1) , 00100011B (ADCCR2) , 11011000B ;Set port register approrriately before setting AD converter registers. (Refer to section I/O port in details) ; Select AIN3 ;Select conversion time(312/fc) and operation mode
SET SLOOP : TEST JRS
(ADCCR1) . 7 (ADCDR2) . 5 T, SLOOP
; ADRS = 1(AD conversion start) ; EOCF= 1 ?
LD LD LD LD
A , (ADCDR2) (9EH) , A A , (ADCDR1) (9FH), A
; Read result data
; Read result data
17.4 STOP/SLOW Modes during AD Conversion
When standby mode (STOP or SLOW mode) is entered forcibly during AD conversion, the AD convert operation is suspended and the AD converter is initialized (ADCCR1 and ADCCR2 are initialized to initial value). Also, the conversion result is indeterminate. (Conversion results up to the previous operation are cleared, so be sure to read the conversion results before entering standby mode (STOP or SLOW mode).) When restored from standby mode (STOP or SLOW mode), AD conversion is not automatically restarted, so it is necessary to restart AD conversion. Note that since the analog reference voltage is automatically disconnected, there is no possibility of current flowing into the analog reference voltage.
Page 175
17. 10-bit AD Converter (ADC)
17.5 Analog Input Voltage and AD Conversion Result TMP86PS64FG
17.5 Analog Input Voltage and AD Conversion Result
The analog input voltage is corresponded to the 10-bit digital value converted by the AD as shown in Figure 17-4.
3FFH 3FEH 3FDH AD conversion result 03H 02H 01H
VAREF AVSS
0
1
2
3 1021 1022 1023 1024 Analog input voltage
1024
Figure 17-4 Analog Input Voltage and AD Conversion Result (Typ.)
Page 176
TMP86PS64FG
17.6 Precautions about AD Converter
17.6.1 Analog input pin voltage range
Make sure the analog input pins (AIN0 to AIN15) are used at voltages within VAREF to AVSS. If any voltage outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncertain. The other analog input pins also are affected by that.
17.6.2 Analog input shared pins
The analog input pins (AIN0 to AIN15) are shared with input/output ports. When using any of the analog inputs to execute AD conversion, do not execute input/output instructions for all other ports. This is necessary to prevent the accuracy of AD conversion from degrading. Not only these analog input shared pins, some other pins may also be affected by noise arising from input/output to and from adjacent pins.
17.6.3 Noise Countermeasure
The internal equivalent circuit of the analog input pins is shown in Figure 17-5. The higher the output impedance of the analog input source, more easily they are susceptible to noise. Therefore, make sure the output impedance of the signal source in your design is 5 k or less. Toshiba also recommends attaching a capacitor external to the chip.
Internal resistance AINi Permissible signal source impedance
5 k (max) 5 k (typ)
Analog comparator
Internal capacitance
C = 22 pF (typ.)
DA converter
Note) i = 15 to 0
Figure 17-5
Analog Input Equivalent Circuit and Example of Input Pin Processing
Page 177
17. 10-bit AD Converter (ADC)
17.6 Precautions about AD Converter TMP86PS64FG
Page 178
TMP86PS64FG
18. Key-on Wakeup (KWU)
In the TMP86PS64FG, the STOP mode is released by not only P20(INT5/STOP) pin but also four (STOP2 to STOP5) pins. When the STOP mode is released by STOP2 to STOP5 pins, the STOP pin needs to be used. In details, refer to the following section " 18.2 Control ".
18.1 Configuration
INT5 STOP mode release signal (1: Release) STOP
STOP2 STOP3 STOP4 STOP5
STOPCR (0031H)
Figure 18-1 Key-on Wakeup Circuit
18.2 Control
STOP2 to STOP5 pins can controlled by Key-on Wakeup Control Register (STOPCR). It can be configured as enable/disable in 1-bit unit. When those pins are used for STOP mode release, configure corresponding I/O pins to input mode by I/O port register beforehand. Key-on Wakeup Control Register
STOPCR (0031H) 7 STOP5 6 STOP4 5 STOP3 4 STOP2 3 2 1 0 (Initial value: 0000 ****)
STOP5 STOP4 STOP3 STOP2
0:Disable 1:Enable 0:Disable 1:Enable 0:Disable 1:Enable 0:Disable 1:Enable
STOP5 STOP4 STOP3 STOP2
STOP mode released by STOP5 STOP mode released by STOP4 STOP mode released by STOP3 STOP mode released by STOP2
Write only Write only Write only Write only
18.3 Function
Stop mode can be entered by setting up the System Control Register (SYSCR1), and can be exited by detecting the "L" level on STOP2 to STOP5 pins, which are enabled by STOPCR, for releasing STOP mode (Note1).
Page 179
18. Key-on Wakeup (KWU)
18.3 Function TMP86PS64FG
Also, each level of the STOP2 to STOP5 pins can be confirmed by reading corresponding I/O port data register, check all STOP2 to STOP5 pins "H" that is enabled by STOPCR before the STOP mode is startd (Note2,3).
Note 1: When the STOP mode released by the edge release mode (SYSCR1 = "0"), inhibit input from STOP2 to STOP5 pins by Key-on Wakeup Control Register (STOPCR) or must be set "H" level into STOP2 to STOP5 pins that are available input during STOP mode. Note 2: When the STOP pin input is high or STOP2 to STOP5 pins inputwhich is enabled by STOPCR is low, executing an instruction which starts STOP mode will not place in STOP mode but instead will immediately start the release sequence (Warm up). Note 3: The input circuit of Key-on Wakeup input and Port input is separatedAAso each input voltage threshold value is diffrent. Therefore, a value comes from port input before STOP mode start may be diffrent from a value which is detected by Key-on Wakeup input (Figure 18-2). Note 4: STOP pin doesn't have the control register such as STOPCR, so when STOP mode is released by STOP2 to STOP5 pins, STOP pin also should be used as STOP mode release function. Note 5: In STOP mode, Key-on Wakeup pin which is enabled as input mode (for releasing STOP mode) by Key-on Wakeup Control Register (STOPCR) may genarate the penetration current, so the said pin must be disabled AD conversion input (analog voltage input). Note 6: When the STOP mode is released by STOP2 to STOP5 pins, the level of STOP pin should hold "L" level (Figure 18-3).
Port input Key-on wakeup input
External pin
Figure 18-2 Key-on Wakeup Input and Port Input
a) STOP
b) In case of STOP2 to STOP5
STOP pin STOP mode Release STOP mode
STOP pin "L"
STOP2 pin
STOP mode
Release STOP mode
Figure 18-3 Priority of STOP pin and STOP2 to STOP5 pins
Table 18-1 Release level (edge) of STOP mode
Release level (edge) Pin name SYSCR1="1" (Note2) "H" level "L" level "L" level "L" level "L" level SYSCR1="0" Rising edge Don't use (Note1) Don't use (Note1) Don't use (Note1) Don't use (Note1)
STOP
STOP2 STOP3 STOP4 STOP5
Page 180
TMP86PS64FG
19. OTP operation
This section describes the funstion and basic operationalblocks of TMP86PS64FG. The TMP86PS64FG has PROM in place of the mask ROM which is included in the TMP86CS64AFG. The configuration and function are the same as the TMP86CS64AFG. In addition, TMP86PS64FG operates as the single clock mode when releasing reset. When using the dual clock mode, oscillate a low-frequency clock by [ SET. (SYSCR2). XTEN ] command at the beginning of program.
19.1 Operating mode
The TMP86PS64FG has MCU mode and PROM mode.
19.1.1 MCU mode
The MCU mode is set by fixing the TEST/VPP pin to the low level. (TEST/VPP pin cannot be used open because it has no built-in pull-down resistor).
19.1.1.1 Program Memory
The TMP86PS64FG has 60K bytes built-in one-time-PROM (addresses 1000 to FFFFH in the MCU mode, addresses 0000 to EFFFH in the PROM mode). When using TMP86PS64FG for evaluation of mask ROM products, the program is written in the program storing area shown in Figure 19-1. Since the TMP86PS64FG supports several mask ROM sizes, check the difference in memory size and program storing area between the one-time PROM and the mask ROM to be used.
Page 181
19. OTP operation
19.1 Operating mode TMP86PS64FG
0000H 1000H
0000H 1000H
0000H
Program Program Program
EFFFH FFFFH Mask ROM FFFFH MCU mode (a) ROM size = 64 Kbytes 0000H 4000H 0000H FFFFH
Don't use PROM mode
0000H 4000H
Don't use 3000H
Program Program Program EFFFH FFFFH Mask ROM FFFFH MCU mode (b) ROM size = 48 Kbytes 0000H 0000H Don't use 7000H 8000H 8000H Program Program FFFFH Mask ROM FFFFH MCU mode (c) ROM size = 32 Kbytes Program EFFFH FFFFH Don't use PROM mode FFFFH
Don't use PROM mode
0000H
Figure 19-1 Program Memory Area
Note: The area that is not in use should be set data to FFH, or a general-purpose PROM programmer should be set only in the program memory area to access.
19.1.1.2 Data Memory
TMP86PS64FG has a built-in 2048 bytes Data memory (static RAM).
19.1.1.3 Input/Output Circuiry
1. Control pins The control pins of the TMP86PS64FG are the same as those of the TMP86CS64AFG except that the TEST pin does not have a built-in pull-down resistor. 2. I/O ports The I/O circuitries of the TMP86PS64FG I/O ports are the same as those of the TMP86CS64AFG.
Page 182
TMP86PS64FG
19.1.2 PROM mode
The PROM mode is set by setting the RESET pin, TEST pin and other pins as shown in Table 19-1 and Figure 19-2. The programming and verification for the internal PROM is acheived by using a general-purpose PROM programmer with the adaptor socket. Table 19-1 Pin name in PROM mode
Pin name (PROM mode) A16 to A15 A14 to A7 A6 to A0 D7 to D0
CE OE PGM
I/O Input Input Input Input/Output Input Input Input Power supply Power supply Power supply Setting pin Setting pin Setting pin Input Output
Function Program memory address input Program memory address input Program memory address input Program memory data input/output Chip enable signal input Output enable signal input Program mode signal input +12.75V/5V (Power supply of program) +6.25V/5V 0V Fix to "H" level in PROM mode Fix to "L" level in PROM mode Fix to "L" level in PROM mode Set oscillation with resonator In case of external CLK input, set CLK to XIN and set XOUT to open.
Pin name (MCU mode) P17 to P16 P77 to P70 P67 to P61 P57 to P50 P13 P14 P15 TEST VDD VSS AVDD,P11,P21 AVSS,VAREF,P00,P10,P20,P22,P60
RESET
VPP VCC GND VCC GND
RESET
XIN (CLK) XOUT
XIN XOUT
Note 1: The high-speed program mode can be used. The setting is different according to the type of PROM programmer to use, refer to each description of PROM programmer. TMP86PS64FG does not support the electric signature mode, apply the ROM type of PROM programmer to TC571000D/AD.
Always set the adapter socket switch to the "N" side when using TOSHIBA's adaptor socket.
Page 183
19. OTP operation
19.1 Operating mode TMP86PS64FG
TMP86PS64FG
VPP (12.5 V/5 V)
VCC
TEST
VCC setting pins
P61 P70
P13 P14 P15 P50
CE OE PGM D0 ~ D7
A16 ~ A0
P71
~
~
P17
XIN
16 MHz
~
P57
GND setting pins XOUT VSS
Refer to pin function for the other pin setting.
GND
Note 1: EPROM adaptor socket (TC571000 * 1M bit EPROM) Note 2: PROM programmer connection adaptor sockets BM11690 for TMP86PS64FG Note 3: Inside pin name for TMP86PS64FG Outside pin name for EPROM
Figure 19-2 PROM mode setting
Page 184
TMP86PS64FG
19.1.2.1 Programming Flowchart (High-speed program writing)
Start VCC = 6.25 V VPP = 12.75 V Address = Start address
N=0
Program 0.1 ms pulse
N=N+1
N = 25? No Error Address = Address + 1 No Verify OK Last address ? Yes VCC = 5 V VPP = 5 V
Yes
Read all data OK Pass
Error
Fail
Figure 19-3 Programming Flowchart
The high-speed programming mode is set by applying Vpp=12.75V (programming voltage) to the Vpp pin when the Vcc = 6.25 V. After the address and data are fixed, the data in the address is written by applying 0.1[msec] of low level program pulse to PGM pin. Then verify if the data is written. If the programmed data is incorrect, another 0.1[msec] pulse is applied to PGM pin. This programming procedure is repeated until correct data is read from the address (maximum of 25 times). Subsequently, all data are programmed in all address. When all data were written, verfy all address under the condition Vcc=Vpp=5V.
Page 185
19. OTP operation
19.1 Operating mode TMP86PS64FG
19.1.2.2 Program Writing using a General-purpose PROM Programmer
1. Recommended OTP adaptor BM11690 for TMP86PS64FG 2. Setting of OTP adaptor Set the switch (SW1) to "N" side. 3. Setting of PROM programmer a. Set PROM type to TC571000D/AD. Vpp: 12.75 V (high-speed program writing mode) b. Data transmission ( or Copy) (Note 1) The PROM of TMP86PS64FG is located on different address; it depends on operating mode: MCU mode and PROM mode. When you write the data of ROM for mask ROM products, the data shuold be transferred (or copied ) from the address for MCU mode to that for PROM mode before writing operation is executed. For the applicable program areas of MCU mode and PROM mode are different, refer to TMP86PS64FG" Figure 19-1 Program Memory Area ". Example: In the block transfer (copy) mode, executed as below. 60KB ROM capacity: 01000~0FFFFH 00000~0EFFFH 48 KB ROM capacity: 04000~0FFFFH 03000~0EFFFH 32KB ROM capacity: 08000~0FFFFH 07000~0EFFFH c. Setting of the program address (Note 1) Start address: 0000H (When 48KB ROM capacity, atart address is 3000H. When 32 KB, ROM capacity, start address is 7000H.) End address: EFFFH 4. Writting Write and verify according to the above procedure "Setting of PROM programmer".
Note 1: For the setting method, refer to each description of PROM programmer. Make sure to set the data of address area that is not in use to FFH. Note 2: When setting MCU to the adaptor or when setting the adaptor to the PROM programmer, set the first pin of the adaptor and that of PROM programmer socket matched. If the first pin is conversely set, MCU or adaptor or programmer would be damaged. Note 3: The TMP86PS64FG does not support the electric signature mode. If PROM programmer uses the signature, the device would be damaged because of applying voltage of 120.5V to pin 9(A9) of the address. Don't use the signature.
Page 186
TMP86PS64FG
20. Input/Output Circuitry
20.1 Control Pins
The input/output circuitries of the TMP86PS64FG control pins are shown below.
Control Pin I/O Input/Output Circuitry Remarks
Osc. enable
fc VDD RO
Resonator connecting pins (high-frequency) Rf = 1.2 M (typ.) RO = 1.5 k (typ.)
XIN XOUT
Input Output
VDD
Rf
XIN
XOUT XTEN fs VDD RO
Resonator connecting pins (Low-frequency) Rf = 6 M (typ.) RO = 220 k (typ.)
Osc. enable
XTIN XTOUT
Input Output
VDD
Rf
XTIN
XTOUT VDD VDD
Hysteresis input Pull-up resistor RIN = 220 k (typ.) R = 1 k (typ.)
R
RESET
RIN
Input
VDD
R
Without pull-down resistor R = 1 k (typ.) Fix the TEST pin at low-level in MCU mode.
TEST
Input
Note: The TEST pin of the TMP86PS64 does not have a pull-down resistor. Fix the TEST pin at low-level in MCU mode.
Page 187
20. Input/Output Circuitry
20.1 Control Pins TMP86PS64FG
20.2 Input/Output Ports
Port I/O Input/Output Circuitry Remarks
Initial "High-Z" Data output
P0 I/O
VDD
Tri-state I/O R = 100 (typ.)
Disable
R
Pin input
Initial "High-Z"
P1 P3 P5 P8 P9
Data output
I/O
VDD
Tri-state I/O Hysteresis input High current output (N-ch)(P5, P9) R = 100 (typ.)
Disable
R
Pin input
Initial "High-Z" Data output
P6 P7 I/O
VDD
RIN
Tri-state I/O Programmable pull-up RIN = 80 k (typ.)
Disable
R
R = 100 (typ.)
Pin input
Initial "High-Z" Data output
PA PB I/O
VDD
RIN
Tri-state I/O Hysteresis input Programmable pull-up RIN = 80 k (typ.) R = 100 (typ.)
Disable
R
Pin input
Initial "High-Z"
VDD
P2
I/O
Data output R Pin input
Sink open drain output Hysteresis input R = 100 (typ.)
Initial "High-Z" Pch control Data output
P4 I/O
VDD
Sink open drain I/O or Tri-state I/O Hysteresis input R = 100 (typ.)
Data input Disable Pin input R
Page 188
TMP86PS64FG
21. Electrical Characteristics
21.1 Absolute Maximum Ratings
The absolute maximum ratings are rated values, which must not be exceeded during operation, even for an instant. Any one of the ratings must not be exceeded. If any absolute maximum rating is exceeded, a device may break down or its performance may be degraded, causing it to catch fire or explode resulting in injury to the user. Thus, when designing products which include this device, ensure that no absolute maximum rating value will ever be exceeded.
(VSS = 0 V) Parameter Supply voltage Program voltage Input voltage Output voltage Symbol VDD VPP VIN VOUT IOUTH Output current (Per 1 pin) IOUT1 IOUT2 Output current (Total) Power dissipation [Topr = 85C] Soldering temperature (Time) Storage temperature Operating temperature IOUT1 IOUT2 PD Tsld Tstg Topr Except open-drain port Except P5, P9 port P5, P9 port Except P5, P9 port P5, P9 port TEST/VPP Pins Ratings -0.3 to 6.5 -0.3 to 13.0 -0.3 to VDD + 0.3 -0.3 to VDD + 0.3 -3.2 3.2 30 60 80 250 260 (10 s) -55 to 125 -40 to 85 C mW mA Unit V V V V
Page 189
21. Electrical Characteristics
21.2 Operating Condition TMP86PS64FG
21.2 Operating Condition
The Operating Conditions show the conditions under which the device be used in order for it to operate normally while maintaining its quality. If the device is used outside the range of Operating Conditions (power supply voltage, operating temperature range, or AC/DC rated values), it may operate erraticially. Therefore, when designing your application equipment, always make sure its intended working conditions will not exceed the range of Operating Conditions.
(VSS = 0 V, Topr = -40 to 85C) Parameter Symbol Pins fc = 16 MHz Condition NORMAL1, 2 mode IDLE0, 1, 2 mode NORMAL1, 2 mode IDLE0, 1, 2 mode SLOW mode SLEEP mode STOP mode VIH1 Input high level VIH2 VIH3 VIL1 Input low level VIL2 VIL3 fc fs XIN, XOUT XTIN, XTOUT Except hysteresis input Hysteresis input Except hysteresis input Hysteresis input VDD 4.5 V VDD < 4.5 V VDD 4.5 V VDD < 4.5 V VDD = 4.5 V to 5.5 V VDD = 2.7 V to 5.5 V 1.0 30.0 2.0 VDD x 0.70 VDD x 0.75 VDD x 0.90 VDD x 0.30 0 VDD x 0.25 VDD x 0.10 16.0 8.0 34.0 MHz kHz VDD V 2.7 5.5 Min 4.5 Max Unit
Supply voltage
VDD
fc = 8 MHz fs = 32.768 kHz
Clock frequency
Page 190
TMP86PS64FG
21.3 DC Characteristics
(VSS = 0 V, Topr = -40 to 85C) Parameter Hysteresis voltage Symbol VHS IIN1 Input current IIN2 IIN3 RIN2 Input resistance RIN3 Rfx Rfxt ILO1 ILO2 VOH VOL IOL2 Pins Hysteresis input TEST Sink open drain, Tri-state port
RESET, STOP RESET pull-up
Condition
Min -
Typ. 0.9
Max -
Unit V
VDD = 5.5 V, VIN = 5.5 V/0 V
-
-
2
A
VDD = 5.5 V, VIN = 0 V VDD = 5.5 V
100 40 - -
220 80 1.2 6 - - - - 20 9.0 5.0 20 10 10
450 200 - - 2 2 - 0.4 - 10.0 mA 6.0 30 20 A 20 k
Programable pull-up (P6, P7, PA, PB port) XIN-XOUT XTIN-XTOUT Sink open drain port Tri-state port Tri-state port Except XOUT, P5, P9 port High current port (P5, P9 port)
Oscilation feedback resistance
M
Output leakage current Output high voltage Output low voltage Output low current Supply current in NORMAL1, 2 mode Supply current in IDLE0, 1, 2 mode Supply current in SLOW1 mode Supply current in SLEEP1 mode Supply current in SLEEP0 mode Supply current in STOP mode
VDD = 5.5 V, VOUT = 5.5 V VDD = 5.5 V, VOUT = 5.5 V/0 V VDD = 4.5 V, VOH = -0.7 mA VDD = 4.5 V, VOL = 1.6 mA VDD = 4.5 V, VOL = 1.0 V VDD = 5.5 V VIN = 5.3/0.2 V fc = 16 MHz fs = 32.768 kHz
- - 4.1 - - - - -
A
V
mA
IDD
VDD = 3.0 V VIN = 2.8 V/0.2 V fs = 32.768 kHz - VDD = 5.5 V VIN = 5.3 V/0.2 V -
-
0.5
10
Note 1: Typical values show those at Topr = 25C, VDD = 5 V Note 2: Input current (IIN3); The current through pull-up resistor is not included. Note 3: IDD does not include IREF current. Note 4: The supply currents in SLOW2 and SLEEP2 modes are equivalent to those in IDLE0, IDLE1, and IDLE2 modes.
Page 191
21. Electrical Characteristics
21.4 AD Conversion Characteristics TMP86PS64FG
21.4 AD Conversion Characteristics
(VSS = 0.0 V, 4.5 V VDD 5.5 V, Topr = -40 to 85C) Parameter Analog reference voltage Power supply voltage of analog control circuit Analog reference voltage range (Note 4) Analog input voltage Power supply current of analog reference voltage Non linearity error Zero point error Full scale error Total error VDD = AVDD = 5.0 V VSS = AVSS = 0.0 V VAREF = 5.0 V Symbol VAREF AVDD AVSS VAREF VAIN IREF VDD = AVDD = VAREF = 5.5 V VSS = AVSS = 0.0 V 3.5 VSS - - - - - Condition Min AVDD - 1.0 Typ. - VDD VSS - - 0.6 - - - - - VAREF 1.0 2 2 2 4 LSB mA V Max AVDD Unit
(VSS = 0.0 V, 2.7 V VDD < 4.5 V, Topr = -40 to 85C) Parameter Analog reference voltage Power supply voltage of analog control circuit Analog reference voltage range (Note 4) Analog input voltage Power supply current of analog reference voltage Non linearity error Zero point error Full scale error Total error VDD = AVDD = 2.7 V VSS = AVSS = 0.0 V VAREF = 2.7 V Symbol VAREF AVDD AVSS VAREF VAIN IREF VDD = AVDD = VAREF = 4.5 V VSS = AVSS = 0.0 V 2.5 VSS - - - - - Condition Min AVDD - 1.0 Typ. - VDD VSS - - 0.5 - - - - - VAREF 0.8 2 2 2 4 LSB mA V Max AVDD Unit
Note 1: The total error includes all errors except a quantization error, and is defined as a maximum deviation from the ideal conversion line. Note 2: Conversion time is different in recommended value by power supply voltage. About conversion time, please refer to "Register Configuration". Note 3: Please use input voltage to AIN input Pin in limit of VAREF - VSS. When voltage of range outside is input, conversion value becomes unsettled and gives affect to other channel conversion value. Note 4: Analog reference voltage range: VAREF = VAREF - VSS Note 5: When AD converter is not used, fix the AVDD pin on the VDD level.
Page 192
TMP86PS64FG
21.5 AC Characteristics
(VSS = 0 V, VDD = 4.5 to 5.5 V, Topr = -40 to 85C) Parameter Symbol Condition NORMAL1, 2 mode Machine cycle time tcy IDLE0, 1, 2 mode SLOW1, 2 mode SLEEP0, 1, 2 mode High level clock pulse width Low level clock pulse width High level clock pulse width Low level clock pulse width tWCH tWCL tWSH tWSL For external clock operation (XIN input) fc = 16 MHz For external clock operation (XTIN input) fs = 32.768 kHz Min 0.25 Typ. - Max 4 s 117.6 - 133.3 Unit
-
31.25
-
ns
-
15.26
-
s
(VSS = 0 V, VDD = 2.7 to 4.5 V, Topr = -40 to 85C) Parameter Symbol Condition NORMAL1, 2 mode Machine cycle time tcy IDLE0, 1, 2 mode SLOW1, 2 mode SLEEP0, 1, 2 mode High level clock pulse width Low level clock pulse width High level clock pulse width Low level clock pulse width tWCH tWCL tWSH tWSL For external clock operation (XIN input) fc = 8 MHz For external clock operation (XTIN input) fs = 32.768 kHz Min 0.5 Typ. - Max 4 s 117.6 - 133.3 Unit
-
62.5
-
ns
-
15.26
-
s
Page 193
21. Electrical Characteristics
21.6 DC Characteristics, AC Characteristics (PROM mode) TMP86PS64FG
21.6 DC Characteristics, AC Characteristics (PROM mode)
21.6.1 Read operation in PROM mode
(VSS = 0 V, Topr = -40 to 85C) Parameter High level input voltage (TTL) Low level input voltage (TTL) Power supply Program supply of program Address access time Symbol VIH4 VIL4 VCC VPP tACC VCC = 5.0 0.25 V Condition Min 2.2 0 4.75 - Typ. - - 5.0 1.5tcyc + 300 Max VCC 0.8 5.25 - ns V Unit
Note: tcyc = 250 ns at fCLK = 16 MHz
A16 to A0
CE
OE
PGM tACC D7 to D0
High-Z Data output
Page 194
TMP86PS64FG
21.6.2 Program operation (High-speed)
(Topr = 25 5 C) Parameter High level input voltage (TTL) Low level input voltage (TTL) Power supply Program supply of program Pulse width of initializing program Symbol VIH4 VIL4 VCC VPP tPW VCC = 6.0 V Condition Min 2.2 0 6.0 12.5 0.095 Typ. - - 6.25 12.75 0.1 Max VCC 0.8 6.5 13.0 0.105 ms V Unit
High-speed program writing
A16 to A0
CE
OE
D7 to D0
Unknown
Input data tPW
Output data
PGM
VPP
Write Verify
Note 1: The power supply of VPP (12.75 V) must be set power-on at the same time or the later time for a power supply of VCC and must be clear power-on at the same time or early time for a power supply of VCC. Note 2: The pull-up/pull-down device on the condition of VPP = 12.75 V 0.25 V causes a damage for the device. Do not pull-up/pull-down at programming. Note 3: Use the recommended adapter and mode. Using other than the above condition may cause the trouble of the writting.
Page 195
21. Electrical Characteristics
21.7 Recommended Oscillating Conditions TMP86PS64FG
21.7 Recommended Oscillating Conditions
XIN XOUT XTIN XTOUT
C1
C2
C1
C2
(1) High-frequency Oscillation
(2) Low-frequency Oscillation
Note 1: To ensure stable oscillation, the resonator position, load capacitance, etc. must be appropriate. Because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will actually be mounted. Note 2: For the resonators to be used with Toshiba microcontrollers, we recommend ceramic resonators manufactured by Murata Manufacturing Co., Ltd. For details, please visit the website of Murata at the following URL: http://www.murata.com
21.8 Handling Precaution
- The solderability test conditions for lead-free products (indicated by the suffix G in product name) are shown below. 1. When using the Sn-37Pb solder bath Solder bath temperature = 230 C Dipping time = 5 seconds Number of times = once R-type flux used 2. When using the Sn-3.0Ag-0.5Cu solder bath Solder bath temperature = 245 C Dipping time = 5 seconds Number of times = once R-type flux used Note: The pass criteron of the above test is as follows: Solderability rate until forming 95 % - When using the device (oscillator) in places exposed to high electric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition.
Page 196
TMP86PS64FG
22. Package Dimensions
QFP100-P-1420-0.65A Rev 01
Unit: mm
Page 197
22. Package Dimensions
TMP86PS64FG
Page 198
This is a technical document that describes the operating functions and electrical specifications of the 8-bit microcontroller series TLCS-870/C (LSI). Toshiba provides a variety of development tools and basic software to enable efficient software development. These development tools have specifications that support advances in microcomputer hardware (LSI) and can be used extensively. Both the hardware and software are supported continuously with version updates. The recent advances in CMOS LSI production technology have been phenomenal and microcomputer systems for LSI design are constantly being improved. The products described in this document may also be revised in the future. Be sure to check the latest specifications before using. Toshiba is developing highly integrated, high-performance microcomputers using advanced MOS production technology and especially well proven CMOS technology. We are prepared to meet the requests for custom packaging for a variety of application areas. We are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP86PS64FG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X